diff options
| author | realtradam <[email protected]> | 2020-03-19 03:32:54 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2020-03-19 03:32:54 -0400 |
| commit | c7e8f17ba13d4c9e54764286367a26f25b049dc4 (patch) | |
| tree | 6ed85dcd09186f9884b77d56c81f94136154577a /Racing-Game/4WheelCar/Wheels/WheelCreation.gd | |
| parent | 57c5f73d0d957dc426d922d591fa5a0dd1452892 (diff) | |
| download | optimal-direction-c7e8f17ba13d4c9e54764286367a26f25b049dc4.tar.gz optimal-direction-c7e8f17ba13d4c9e54764286367a26f25b049dc4.zip | |
fixed up file structure
Diffstat (limited to 'Racing-Game/4WheelCar/Wheels/WheelCreation.gd')
| -rw-r--r-- | Racing-Game/4WheelCar/Wheels/WheelCreation.gd | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Racing-Game/4WheelCar/Wheels/WheelCreation.gd b/Racing-Game/4WheelCar/Wheels/WheelCreation.gd new file mode 100644 index 0000000..db09f4b --- /dev/null +++ b/Racing-Game/4WheelCar/Wheels/WheelCreation.gd @@ -0,0 +1,35 @@ +extends Node + + +# This script creates and attaches all the wheels. Depending on the variables +# given to this script, it can generate different type of vehicles + + +# Called when the node enters the scene tree for the first time. +func _ready(): + createWheel("front", [17,-27]) + createWheel("front", [-17,-27]) + createWheel("back", [20,36]) + createWheel("back", [-20,36]) + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass + +func createWheel(type,dataArray): + if(type == "front"): + var wheeltemp_resource = load("res://4WheelCar/Wheels/FrontWheel.tscn") + var wheeltemp = wheeltemp_resource.instance() + wheeltemp.set_position(Vector2(dataArray[0],dataArray[1])) + add_child(wheeltemp) + wheeltemp.initVars(dataArray) + +# add_child(tempA) + elif(type == "back"): + var wheeltemp_resource = load("res://4WheelCar/Wheels/BackWheel.tscn") + var wheeltemp = wheeltemp_resource.instance() + wheeltemp.set_position(Vector2(dataArray[0],dataArray[1])) + add_child(wheeltemp) + wheeltemp.initVars(dataArray) |
