diff options
Diffstat (limited to 'Racing-Game/4WheelCar')
| -rw-r--r-- | Racing-Game/4WheelCar/BLLine.gd | 25 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/BRLine.gd | 30 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/CPUParticles2D.gd | 13 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/Engine.gd | 13 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/FLLine.gd | 25 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/FRLine.gd | 25 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/FrontWheel.gd | 2 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/FrontWheelSprite.gd | 17 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/SkidController.gd | 4 | ||||
| -rw-r--r-- | Racing-Game/4WheelCar/Skidmark.tscn | 11 |
10 files changed, 162 insertions, 3 deletions
diff --git a/Racing-Game/4WheelCar/BLLine.gd b/Racing-Game/4WheelCar/BLLine.gd new file mode 100644 index 0000000..042b034 --- /dev/null +++ b/Racing-Game/4WheelCar/BLLine.gd @@ -0,0 +1,25 @@ +extends Line2D + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +var tempnode = 0 +var on = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + tempnode = get_node("../Cars/4WheelCar/CarBody/Wheels/BLWheel") + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_BLWheel_slip(): + if(on): + add_point(tempnode.get_global_position()) + + +func _on_BLWheel_end(): + duplicate(1) + on = false diff --git a/Racing-Game/4WheelCar/BRLine.gd b/Racing-Game/4WheelCar/BRLine.gd new file mode 100644 index 0000000..16578e3 --- /dev/null +++ b/Racing-Game/4WheelCar/BRLine.gd @@ -0,0 +1,30 @@ +extends Line2D + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +var tempnode = 0 +var on = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + print("ready") + tempnode = get_node("../Cars/4WheelCar/CarBody/Wheels/BRWheel") + clear_points() + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_BRWheel_slip(): + while on: + print("slip2") + add_point(tempnode.get_global_position()) + + +func _on_BRWheel_end(): + on = false + print("duplicated") + var duplication = duplicate(13) + duplication.request_ready() diff --git a/Racing-Game/4WheelCar/CPUParticles2D.gd b/Racing-Game/4WheelCar/CPUParticles2D.gd new file mode 100644 index 0000000..d5eaef4 --- /dev/null +++ b/Racing-Game/4WheelCar/CPUParticles2D.gd @@ -0,0 +1,13 @@ +extends CPUParticles2D + +# 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/Engine.gd b/Racing-Game/4WheelCar/Engine.gd new file mode 100644 index 0000000..46c8298 --- /dev/null +++ b/Racing-Game/4WheelCar/Engine.gd @@ -0,0 +1,13 @@ +extends RigidBody2D + +# 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): + set_rotation(get_node("../../CarBody").get_rotation()) diff --git a/Racing-Game/4WheelCar/FLLine.gd b/Racing-Game/4WheelCar/FLLine.gd new file mode 100644 index 0000000..fffcf04 --- /dev/null +++ b/Racing-Game/4WheelCar/FLLine.gd @@ -0,0 +1,25 @@ +extends Line2D + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +var tempnode = 0 +var on = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + tempnode = get_node("../Cars/4WheelCar/CarBody/Wheels/FLWheel") + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_FLWheel_slip(): + if(on): + add_point(tempnode.get_global_position()) + + +func _on_FLWheel_end(): + duplicate(1) + on = false diff --git a/Racing-Game/4WheelCar/FRLine.gd b/Racing-Game/4WheelCar/FRLine.gd new file mode 100644 index 0000000..e1fbc0f --- /dev/null +++ b/Racing-Game/4WheelCar/FRLine.gd @@ -0,0 +1,25 @@ +extends Line2D + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +var tempnode = 0 +var on = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + tempnode = get_node("../Cars/4WheelCar/CarBody/Wheels/FRWheel") + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + +func _on_FRWheel_slip(): + if(on): + add_point(tempnode.get_global_position()) + + +func _on_FRWheel_end(): + duplicate(1) + on = false diff --git a/Racing-Game/4WheelCar/FrontWheel.gd b/Racing-Game/4WheelCar/FrontWheel.gd index 2333113..280a8a3 100644 --- a/Racing-Game/4WheelCar/FrontWheel.gd +++ b/Racing-Game/4WheelCar/FrontWheel.gd @@ -10,7 +10,7 @@ var velAngle var carAngle var delay = 0 -onready var skidObj = preload("res://Skidmark.tscn") +onready var skidObj = preload("res://4WheelCar/Skidmark.tscn") var steerDamp = 1 diff --git a/Racing-Game/4WheelCar/FrontWheelSprite.gd b/Racing-Game/4WheelCar/FrontWheelSprite.gd new file mode 100644 index 0000000..e0426d4 --- /dev/null +++ b/Racing-Game/4WheelCar/FrontWheelSprite.gd @@ -0,0 +1,17 @@ +extends Sprite + +# 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): +# if Input.is_key_pressed(KEY_A): +# set_rotation(get_node("../../../../CarBody").get_rotation()-PI/4) +# if Input.is_key_pressed(KEY_D): +# set_rotation(get_node("../../../../CarBody").get_rotation()+PI/4) + pass diff --git a/Racing-Game/4WheelCar/SkidController.gd b/Racing-Game/4WheelCar/SkidController.gd index 105eb3b..745b195 100644 --- a/Racing-Game/4WheelCar/SkidController.gd +++ b/Racing-Game/4WheelCar/SkidController.gd @@ -11,7 +11,7 @@ var deleteme = 0; # Called when the node enters the scene tree for the first time. func _ready(): - skidFile = load("res://Skidmark.tscn") + skidFile = load("res://4WheelCar/Skidmark.tscn") skidRecent = skidFile.instance() add_child(skidRecent) @@ -25,7 +25,7 @@ func _process(delta): # create new skidding child, and set skid to true skidSwitch = true - skidFile = load("res://Skidmark.tscn") + skidFile = load("res://4WheelCar/Skidmark.tscn") skidRecent = skidFile.instance() add_child(skidRecent) #set to run diff --git a/Racing-Game/4WheelCar/Skidmark.tscn b/Racing-Game/4WheelCar/Skidmark.tscn new file mode 100644 index 0000000..46c5d40 --- /dev/null +++ b/Racing-Game/4WheelCar/Skidmark.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Art(non-orig)/PNG/Objects/skidmark_short_1.png" type="Texture" id=1] +[ext_resource path="res://4WheelCar/Skidmarks.gd" type="Script" id=2] + +[node name="Skidmark" type="Line2D"] +position = Vector2( -21.2326, -38.4176 ) +default_color = Color( 0.4, 0.501961, 1, 1 ) +texture = ExtResource( 1 ) +texture_mode = 192263440 +script = ExtResource( 2 ) |
