summaryrefslogtreecommitdiffhomepage
path: root/Racing-Game/4WheelCar/Wheels/WheelCreation.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Racing-Game/4WheelCar/Wheels/WheelCreation.gd')
-rw-r--r--Racing-Game/4WheelCar/Wheels/WheelCreation.gd35
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)