summaryrefslogtreecommitdiffhomepage
path: root/Racing-Game/4WheelCar/WheelCreation.gd
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2020-03-19 03:06:35 -0400
committerrealtradam <[email protected]>2020-03-19 03:06:35 -0400
commit2e7c27e3934fd9c73f7e6cd414a50a9a17e1669c (patch)
treea326cf8298580e28aa76766ec2836f980257f428 /Racing-Game/4WheelCar/WheelCreation.gd
parent0fe77a326aec5732920dd3b23b36fd3405ff9e25 (diff)
downloadoptimal-direction-2e7c27e3934fd9c73f7e6cd414a50a9a17e1669c.tar.gz
optimal-direction-2e7c27e3934fd9c73f7e6cd414a50a9a17e1669c.zip
Wheels have been made more modular and easier to modify properties
Diffstat (limited to 'Racing-Game/4WheelCar/WheelCreation.gd')
-rw-r--r--Racing-Game/4WheelCar/WheelCreation.gd36
1 files changed, 36 insertions, 0 deletions
diff --git a/Racing-Game/4WheelCar/WheelCreation.gd b/Racing-Game/4WheelCar/WheelCreation.gd
new file mode 100644
index 0000000..7c6b192
--- /dev/null
+++ b/Racing-Game/4WheelCar/WheelCreation.gd
@@ -0,0 +1,36 @@
+extends Node
+
+
+# Declare member variables here. Examples:
+# var a = 2
+# var b = "text"
+
+
+# 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/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/BackWheel.tscn")
+ var wheeltemp = wheeltemp_resource.instance()
+ wheeltemp.set_position(Vector2(dataArray[0],dataArray[1]))
+ add_child(wheeltemp)
+ wheeltemp.initVars(dataArray)