summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Racing-Game/4WheelCar/Weight/Weight.gd6
-rw-r--r--Racing-Game/4WheelCar/Weight/WeightCreation.gd8
-rw-r--r--Racing-Game/4WheelCar/Wheels/Wheel.gd4
-rw-r--r--Racing-Game/4WheelCar/Wheels/WheelCreation.gd18
4 files changed, 18 insertions, 18 deletions
diff --git a/Racing-Game/4WheelCar/Weight/Weight.gd b/Racing-Game/4WheelCar/Weight/Weight.gd
index ea9e615..6db46fa 100644
--- a/Racing-Game/4WheelCar/Weight/Weight.gd
+++ b/Racing-Game/4WheelCar/Weight/Weight.gd
@@ -10,11 +10,11 @@ func _ready():
#func _process(delta):
# pass
-func initVars(dataArray):
+func initVars(locX,locY,Mass):
# #---Creating and attaching pinjoint to wheel
- mass = dataArray[2]
+ mass = Mass
var tempA = PinJoint2D.new()
- tempA.set_position(Vector2(dataArray[0],dataArray[1]))
+ tempA.set_position(Vector2(locX,locY))
print(get_parent().get_parent().get_path())
tempA.set_node_a(get_path())
tempA.set_node_b(get_parent().get_parent().get_path())
diff --git a/Racing-Game/4WheelCar/Weight/WeightCreation.gd b/Racing-Game/4WheelCar/Weight/WeightCreation.gd
index 290325c..a6d9786 100644
--- a/Racing-Game/4WheelCar/Weight/WeightCreation.gd
+++ b/Racing-Game/4WheelCar/Weight/WeightCreation.gd
@@ -7,7 +7,7 @@ extends Node
# Called when the node enters the scene tree for the first time.
func _ready():
- createWeight([0,30,30])
+ createWeight(0,30,30)
pass # Replace with function body.
@@ -15,9 +15,9 @@ func _ready():
#func _process(delta):
# pass
-func createWeight(dataArray):
+func createWeight(locX,locY,Mass):
var weighttemp_resource = load("res://4WheelCar/Weight/Weight.tscn")
var weighttemp = weighttemp_resource.instance()
- weighttemp.set_position(Vector2(dataArray[0],dataArray[1]))
+ weighttemp.set_position(Vector2(locX,locY))
add_child(weighttemp)
- weighttemp.initVars(dataArray)
+ weighttemp.initVars(locX,locY,Mass)
diff --git a/Racing-Game/4WheelCar/Wheels/Wheel.gd b/Racing-Game/4WheelCar/Wheels/Wheel.gd
index 49024fb..d25cec5 100644
--- a/Racing-Game/4WheelCar/Wheels/Wheel.gd
+++ b/Racing-Game/4WheelCar/Wheels/Wheel.gd
@@ -24,10 +24,10 @@ func _ready():
func _process(_delta):
pass
-func initVars(dataArray):
+func initVars(locX,locY):
# #---Creating and attaching pinjoint to wheel
var tempA = PinJoint2D.new()
- tempA.set_position(Vector2(dataArray[0],dataArray[1]))
+ tempA.set_position(Vector2(locX,locY))
tempA.set_node_a(get_path())
tempA.set_node_b(get_parent().get_parent().get_path())
tempA.softness = 0
diff --git a/Racing-Game/4WheelCar/Wheels/WheelCreation.gd b/Racing-Game/4WheelCar/Wheels/WheelCreation.gd
index db09f4b..06f354e 100644
--- a/Racing-Game/4WheelCar/Wheels/WheelCreation.gd
+++ b/Racing-Game/4WheelCar/Wheels/WheelCreation.gd
@@ -7,10 +7,10 @@ extends Node
# 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])
+ createWheel(17,-27,"front")
+ createWheel(-17,-27,"front")
+ createWheel(20,36,"back")
+ createWheel(-20,36,"back")
pass # Replace with function body.
@@ -18,18 +18,18 @@ func _ready():
#func _process(delta):
# pass
-func createWheel(type,dataArray):
+func createWheel(locX, locY, type):
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]))
+ wheeltemp.set_position(Vector2(locX,locY))
add_child(wheeltemp)
- wheeltemp.initVars(dataArray)
+ wheeltemp.initVars(locX,locY)
# 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]))
+ wheeltemp.set_position(Vector2(locX,locY))
add_child(wheeltemp)
- wheeltemp.initVars(dataArray)
+ wheeltemp.initVars(locX,locY)