summaryrefslogtreecommitdiffhomepage
path: root/Racing-Game
diff options
context:
space:
mode:
Diffstat (limited to 'Racing-Game')
-rw-r--r--Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.md53
-rw-r--r--Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.stexbin0 -> 324 bytes
-rw-r--r--Racing-Game/4WheelCar/4WheelCar.tscn127
-rw-r--r--Racing-Game/4WheelCar/BackWheel.gd1
-rw-r--r--Racing-Game/4WheelCar/BackWheel.tscn28
-rw-r--r--Racing-Game/4WheelCar/CarProperties.gd23
-rw-r--r--Racing-Game/4WheelCar/FrontWheel.tscn28
-rw-r--r--Racing-Game/4WheelCar/Wheel.gd17
-rw-r--r--Racing-Game/4WheelCar/WheelCreation.gd36
-rw-r--r--Racing-Game/Art(non-orig)/crosshair(isorig).pngbin0 -> 739 bytes
-rw-r--r--Racing-Game/Art(non-orig)/crosshair(isorig).png.import34
11 files changed, 186 insertions, 111 deletions
diff --git a/Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.md5 b/Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.md5
new file mode 100644
index 0000000..ca3b62c
--- /dev/null
+++ b/Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.md5
@@ -0,0 +1,3 @@
+source_md5="f3c05f995b5d20810df3920bf35f32eb"
+dest_md5="98235f608d5aa8e6a6a77bcd858a94ff"
+
diff --git a/Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.stex b/Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.stex
new file mode 100644
index 0000000..56f18ca
--- /dev/null
+++ b/Racing-Game/.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.stex
Binary files differ
diff --git a/Racing-Game/4WheelCar/4WheelCar.tscn b/Racing-Game/4WheelCar/4WheelCar.tscn
index 81fef02..de13e82 100644
--- a/Racing-Game/4WheelCar/4WheelCar.tscn
+++ b/Racing-Game/4WheelCar/4WheelCar.tscn
@@ -1,42 +1,24 @@
-[gd_scene load_steps=10 format=2]
+[gd_scene load_steps=8 format=2]
[ext_resource path="res://4WheelCar/CarBody.gd" type="Script" id=1]
[ext_resource path="res://Art(non-orig)/PNG/Cars/big/blue/car_blue_2.png" type="Texture" id=2]
-[ext_resource path="res://4WheelCar/FrontWheel.gd" type="Script" id=3]
-[ext_resource path="res://4WheelCar/Skid/SkidController.gd" type="Script" id=4]
-[ext_resource path="res://4WheelCar/BackWheel.gd" type="Script" id=5]
-
-[sub_resource type="RectangleShape2D" id=1]
+[ext_resource path="res://Art(non-orig)/crosshair(isorig).png" type="Texture" id=3]
+[ext_resource path="res://4WheelCar/CarProperties.gd" type="Script" id=6]
+[ext_resource path="res://4WheelCar/WheelCreation.gd" type="Script" id=9]
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 35.7301, 58.1399 )
-[sub_resource type="RectangleShape2D" id=3]
-extents = Vector2( 6.93714, 14.1584 )
-
-[sub_resource type="RectangleShape2D" id=4]
-extents = Vector2( 7.07375, 14.3787 )
+[sub_resource type="RectangleShape2D" id=1]
[node name="4WheelCar" type="Node"]
+script = ExtResource( 6 )
[node name="CarBody" type="RigidBody2D" parent="."]
position = Vector2( -0.446396, -0.582428 )
z_index = 1
-mass = 20.0
-script = ExtResource( 1 )
-
-[node name="Engine" type="RigidBody2D" parent="CarBody"]
-position = Vector2( 0, 26 )
-z_index = 2
mass = 30.0
-
-[node name="CollisionShape2D" type="CollisionShape2D" parent="CarBody/Engine"]
-z_index = 2
-shape = SubResource( 1 )
-disabled = true
-__meta__ = {
-"_edit_group_": true
-}
+script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="CarBody"]
texture = ExtResource( 2 )
@@ -46,97 +28,26 @@ visible = false
modulate = Color( 0, 0, 0, 1 )
shape = SubResource( 2 )
-[node name="Wheels" type="Node" parent="CarBody"]
-
-[node name="FRWheel" type="RigidBody2D" parent="CarBody/Wheels"]
-position = Vector2( 24.7786, -36.8564 )
-mass = 15.0
-linear_damp = 0.4
-angular_damp = 7.04
-script = ExtResource( 3 )
-__meta__ = {
-"_edit_group_": true
-}
-
-[node name="CollisionShape2D" type="CollisionShape2D" parent="CarBody/Wheels/FRWheel"]
-shape = SubResource( 3 )
-disabled = true
-
-[node name="SkidController4" type="Node" parent="CarBody/Wheels/FRWheel"]
-script = ExtResource( 4 )
-
-[node name="FLWheel" type="RigidBody2D" parent="CarBody/Wheels"]
-position = Vector2( -25.6184, -36.8564 )
-mass = 15.0
-linear_damp = 0.4
-angular_damp = 7.04
-script = ExtResource( 3 )
-__meta__ = {
-"_edit_group_": true
-}
-
-[node name="CollisionShape2D" type="CollisionShape2D" parent="CarBody/Wheels/FLWheel"]
-shape = SubResource( 4 )
-disabled = true
-
-[node name="SkidController3" type="Node" parent="CarBody/Wheels/FLWheel"]
-script = ExtResource( 4 )
-
-[node name="BLWheel" type="RigidBody2D" parent="CarBody/Wheels"]
-position = Vector2( -22.4074, 38.5726 )
-mass = 15.0
-linear_damp = 0.4
-angular_damp = 7.04
-script = ExtResource( 5 )
-__meta__ = {
-"_edit_group_": true
-}
+[node name="Engine" type="RigidBody2D" parent="CarBody"]
+position = Vector2( 0, 26 )
+z_index = 2
+mass = 10.0
-[node name="CollisionShape2D" type="CollisionShape2D" parent="CarBody/Wheels/BLWheel"]
-shape = SubResource( 4 )
+[node name="CollisionShape2D" type="CollisionShape2D" parent="CarBody/Engine"]
+z_index = 2
+shape = SubResource( 1 )
disabled = true
-
-[node name="SkidController2" type="Node" parent="CarBody/Wheels/BLWheel"]
-script = ExtResource( 4 )
-
-[node name="BRWheel" type="RigidBody2D" parent="CarBody/Wheels"]
-position = Vector2( 21.2326, 38.4176 )
-mass = 15.0
-linear_damp = 0.4
-angular_damp = 7.04
-script = ExtResource( 5 )
__meta__ = {
"_edit_group_": true
}
-[node name="CollisionShape2D" type="CollisionShape2D" parent="CarBody/Wheels/BRWheel"]
-shape = SubResource( 4 )
-disabled = true
-
-[node name="SkidController" type="Node" parent="CarBody/Wheels/BRWheel"]
-script = ExtResource( 4 )
-
-[node name="PinJointFR" type="PinJoint2D" parent="CarBody"]
-position = Vector2( 25.2246, -36.274 )
-node_a = NodePath("../Wheels/FRWheel")
-node_b = NodePath("..")
+[node name="Sprite" type="Sprite" parent="CarBody/Engine"]
+texture = ExtResource( 3 )
-[node name="PinJointBR" type="PinJoint2D" parent="CarBody"]
-position = Vector2( 21.6786, 39.155 )
-node_a = NodePath("../Wheels/BRWheel")
-node_b = NodePath("..")
-
-[node name="PinJointBL" type="PinJoint2D" parent="CarBody"]
-position = Vector2( -21.961, 39.155 )
-node_a = NodePath("../Wheels/BLWheel")
-node_b = NodePath("..")
-
-[node name="PinJointFL" type="PinJoint2D" parent="CarBody"]
-position = Vector2( -25.1724, -36.274 )
-node_a = NodePath("../Wheels/FLWheel")
-node_b = NodePath("..")
+[node name="Wheels" type="Node" parent="CarBody"]
+script = ExtResource( 9 )
[node name="PinjointEngine" type="PinJoint2D" parent="CarBody"]
position = Vector2( 0, 26 )
-node_a = NodePath("../..")
+node_a = NodePath("../Engine")
node_b = NodePath("..")
diff --git a/Racing-Game/4WheelCar/BackWheel.gd b/Racing-Game/4WheelCar/BackWheel.gd
index 1d6ee18..e4a95d7 100644
--- a/Racing-Game/4WheelCar/BackWheel.gd
+++ b/Racing-Game/4WheelCar/BackWheel.gd
@@ -33,6 +33,7 @@ func _process(delta):
if Input.is_action_pressed("forward"):
if !Input.is_action_pressed("brake"):
+ print("GO")
apply_central_impulse(Vector2(0,-gear(velocity, hp, acceleration)).rotated(carAngle)*delta*5000)
else:
pass
diff --git a/Racing-Game/4WheelCar/BackWheel.tscn b/Racing-Game/4WheelCar/BackWheel.tscn
new file mode 100644
index 0000000..e493d24
--- /dev/null
+++ b/Racing-Game/4WheelCar/BackWheel.tscn
@@ -0,0 +1,28 @@
+[gd_scene load_steps=5 format=2]
+
+[ext_resource path="res://4WheelCar/Skid/SkidController.gd" type="Script" id=1]
+[ext_resource path="res://4WheelCar/BackWheel.gd" type="Script" id=2]
+[ext_resource path="res://Art(non-orig)/crosshair(isorig).png" type="Texture" id=3]
+
+[sub_resource type="RectangleShape2D" id=1]
+extents = Vector2( 7.07375, 14.3787 )
+
+[node name="BackWheel" type="RigidBody2D"]
+z_index = 2
+mass = 15.0
+linear_damp = 0.4
+angular_damp = 7.04
+script = ExtResource( 2 )
+__meta__ = {
+"_edit_group_": true
+}
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+shape = SubResource( 1 )
+disabled = true
+
+[node name="SkidController2" type="Node" parent="."]
+script = ExtResource( 1 )
+
+[node name="Sprite" type="Sprite" parent="."]
+texture = ExtResource( 3 )
diff --git a/Racing-Game/4WheelCar/CarProperties.gd b/Racing-Game/4WheelCar/CarProperties.gd
new file mode 100644
index 0000000..c4a5ad5
--- /dev/null
+++ b/Racing-Game/4WheelCar/CarProperties.gd
@@ -0,0 +1,23 @@
+extends Node
+
+var steerSplitA = 20
+var steerSplitB = 40
+var steerHeight = 2.6
+var steerLimit = 73
+var steerMinimum = 1
+
+var hp = 4.0
+var acceleration = 5
+# 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():
+ pass # Replace with function body.
+
+
+# Called every frame. 'delta' is the elapsed time since the previous frame.
+#func _process(delta):
+# pass
diff --git a/Racing-Game/4WheelCar/FrontWheel.tscn b/Racing-Game/4WheelCar/FrontWheel.tscn
new file mode 100644
index 0000000..330e147
--- /dev/null
+++ b/Racing-Game/4WheelCar/FrontWheel.tscn
@@ -0,0 +1,28 @@
+[gd_scene load_steps=5 format=2]
+
+[ext_resource path="res://4WheelCar/Skid/SkidController.gd" type="Script" id=1]
+[ext_resource path="res://4WheelCar/FrontWheel.gd" type="Script" id=2]
+[ext_resource path="res://Art(non-orig)/crosshair(isorig).png" type="Texture" id=3]
+
+[sub_resource type="RectangleShape2D" id=1]
+extents = Vector2( 6.93714, 14.1584 )
+
+[node name="FrontWheel" type="RigidBody2D"]
+z_index = 2
+mass = 15.0
+linear_damp = 0.4
+angular_damp = 7.04
+script = ExtResource( 2 )
+__meta__ = {
+"_edit_group_": true
+}
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
+shape = SubResource( 1 )
+disabled = true
+
+[node name="SkidController4" type="Node" parent="."]
+script = ExtResource( 1 )
+
+[node name="Sprite" type="Sprite" parent="."]
+texture = ExtResource( 3 )
diff --git a/Racing-Game/4WheelCar/Wheel.gd b/Racing-Game/4WheelCar/Wheel.gd
index 7d36cd8..88ab9b1 100644
--- a/Racing-Game/4WheelCar/Wheel.gd
+++ b/Racing-Game/4WheelCar/Wheel.gd
@@ -23,10 +23,21 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
pass
-
-
-
+func initVars(dataArray):
+# #---Creating and attaching pinjoint to wheel
+ var tempA = PinJoint2D.new()
+ tempA.set_position(Vector2(dataArray[0],dataArray[1]))
+# var tempB = Sprite.new()
+ print(get_parent().get_parent().get_path())
+ tempA.set_node_a(get_path())
+ tempA.set_node_b(get_parent().get_parent().get_path())
+ tempA.softness = 0
+ tempA.bias = 0
+ tempA.disable_collision = true
+ get_parent().add_child(tempA)
+# #---
+ pass
func null_slide(var strength, var delta):
#strength is how strong you would like the nullify to be
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)
diff --git a/Racing-Game/Art(non-orig)/crosshair(isorig).png b/Racing-Game/Art(non-orig)/crosshair(isorig).png
new file mode 100644
index 0000000..73cf8b0
--- /dev/null
+++ b/Racing-Game/Art(non-orig)/crosshair(isorig).png
Binary files differ
diff --git a/Racing-Game/Art(non-orig)/crosshair(isorig).png.import b/Racing-Game/Art(non-orig)/crosshair(isorig).png.import
new file mode 100644
index 0000000..1d036e3
--- /dev/null
+++ b/Racing-Game/Art(non-orig)/crosshair(isorig).png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://Art(non-orig)/crosshair(isorig).png"
+dest_files=[ "res://.import/crosshair(isorig).png-c5078e5c5a71be1e20616ddd159d1037.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0