summaryrefslogtreecommitdiffhomepage
path: root/Racing-Game/4WheelCar/BackWheel.gd
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2020-03-19 03:32:54 -0400
committerrealtradam <[email protected]>2020-03-19 03:32:54 -0400
commitc7e8f17ba13d4c9e54764286367a26f25b049dc4 (patch)
tree6ed85dcd09186f9884b77d56c81f94136154577a /Racing-Game/4WheelCar/BackWheel.gd
parent57c5f73d0d957dc426d922d591fa5a0dd1452892 (diff)
downloadoptimal-direction-c7e8f17ba13d4c9e54764286367a26f25b049dc4.tar.gz
optimal-direction-c7e8f17ba13d4c9e54764286367a26f25b049dc4.zip
fixed up file structure
Diffstat (limited to 'Racing-Game/4WheelCar/BackWheel.gd')
-rw-r--r--Racing-Game/4WheelCar/BackWheel.gd50
1 files changed, 0 insertions, 50 deletions
diff --git a/Racing-Game/4WheelCar/BackWheel.gd b/Racing-Game/4WheelCar/BackWheel.gd
deleted file mode 100644
index 1d6ee18..0000000
--- a/Racing-Game/4WheelCar/BackWheel.gd
+++ /dev/null
@@ -1,50 +0,0 @@
-extends "res://4WheelCar/Wheel.gd"
-
-#Accelerating
-var hp = 4.0
-var acceleration = 5
-
-var gripDelay = 0
-
-func _ready():
- pass
-
-func _process(delta):
- #Variable Setup
- #---null_slide vars
- nullStrength = 0
- carAngle = get_node("../../../CarBody").get_transform().get_rotation()
- velVector = get_node("../../../CarBody").get_linear_velocity()
- velocity = measure_velocity()
- #---
- set_rotation(carAngle)
-
- isSkid = Input.is_action_pressed("grip")
-
- if Input.is_action_pressed("grip") || Input.is_action_pressed("brake"):
- nullStrength += max(5,velocity/7)
- else:
- nullStrength += 1
-
- #Braking
- setBrake(0)
- null_slide(nullStrength, delta)
-
-
- if Input.is_action_pressed("forward"):
- if !Input.is_action_pressed("brake"):
- apply_central_impulse(Vector2(0,-gear(velocity, hp, acceleration)).rotated(carAngle)*delta*5000)
- else:
- pass
- elif Input.is_action_pressed("backward"):
- if !Input.is_action_pressed("brake"):
- apply_central_impulse(Vector2(0,(1)).rotated(carAngle)*delta*5000)
- else:
- pass
-
-func measure_velocity():
- return sqrt(get_linear_velocity().dot(get_linear_velocity()))/12
-
-
-func gear(var rpm, var maxPower, var topSpeed):
- return max(-pow((rpm/((1000/topSpeed)/sqrt(maxPower)))-sqrt(maxPower),2)+(maxPower+1),0)