Skip to content
Snippets Groups Projects
Commit 4f002d8f authored by Midras Lappe's avatar Midras Lappe
Browse files

Comented on code in Godot Project deleted old Code

parent 49e58574
No related branches found
No related tags found
No related merge requests found
...@@ -25,18 +25,15 @@ var wheel_base = 70 # distance between wheels in pixels ...@@ -25,18 +25,15 @@ var wheel_base = 70 # distance between wheels in pixels
var engine_power = 1 # can be lowered if you want the car to accelerate and brake slower var engine_power = 1 # can be lowered if you want the car to accelerate and brake slower
var braking = -360*2 # braking power var braking = -360*2 # braking power
#export var car_step_finished = false
export var score = 250 export var score = 250
var acceleration = Vector2.ZERO var acceleration = Vector2.ZERO
export var velocity = Vector2.ZERO export var velocity = Vector2.ZERO
export var steer_direction = 0 export var steer_direction = 0
#var collisions = 0
#export var Sensor1 = 0
#var collisionTimer = 1
var scoreTimer = 1 var scoreTimer = 1
export var scoreTimerFreeze = false #toogled when finish Line is reached to stop lowering the score export var scoreTimerFreeze = false #toogled when finish Line is reached to stop lowering the score
...@@ -51,7 +48,6 @@ func reset(): ...@@ -51,7 +48,6 @@ func reset():
velocity = Vector2.ZERO velocity = Vector2.ZERO
steer_direction = 0 steer_direction = 0
score = 250 score = 250
#collisionTimer = 1
scoreTimerFreeze = false scoreTimerFreeze = false
turn = 0 turn = 0
...@@ -66,7 +62,7 @@ func _ready(): ...@@ -66,7 +62,7 @@ func _ready():
func _network_process(delta): func _network_process(delta):
# calls all actions of a step # calls all actions of a step
# _collision_Timer(delta)
_score_Timer(delta) _score_Timer(delta)
acceleration = Vector2.ZERO acceleration = Vector2.ZERO
calc_steering(delta) calc_steering(delta)
...@@ -78,7 +74,6 @@ func _network_process(delta): ...@@ -78,7 +74,6 @@ func _network_process(delta):
linear_velocityN = velocity linear_velocityN = velocity
calc_distance_Sensor() calc_distance_Sensor()
#car_step_finished = true
func calc_distance_Sensor(): func calc_distance_Sensor():
...@@ -179,11 +174,6 @@ func calc_orientation(delta): ...@@ -179,11 +174,6 @@ func calc_orientation(delta):
linear_velocityN = velocity linear_velocityN = velocity
rotation = new_heading.angle() rotation = new_heading.angle()
#func _on_Player_body_entered(_body):
# #print("Kollision: -50 Punkte")
# score -= 50
# score_delta -= 50
# #print("Body entered" + str(score_delta))
......
...@@ -49,5 +49,4 @@ visible = false ...@@ -49,5 +49,4 @@ visible = false
points = PoolVector2Array( 0, 0, 186.399, 37.9332 ) points = PoolVector2Array( 0, 0, 186.399, 37.9332 )
width_curve = SubResource( 3 ) width_curve = SubResource( 3 )
default_color = Color( 0.4, 0.494118, 1, 1 ) default_color = Color( 0.4, 0.494118, 1, 1 )
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] [connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
...@@ -22,7 +22,7 @@ func _ready(): ...@@ -22,7 +22,7 @@ func _ready():
# visible = !visible # visible = !visible
func _network_process(delta): func _network_process(_delta):
#if Player is available update Lables #if Player is available update Lables
if player: if player:
var speedinkmh=player.velocity.length()/32*3.6 var speedinkmh=player.velocity.length()/32*3.6
......
...@@ -71,7 +71,5 @@ shape = SubResource( 6 ) ...@@ -71,7 +71,5 @@ shape = SubResource( 6 )
[node name="SpeedTimer" type="Timer" parent="."] [node name="SpeedTimer" type="Timer" parent="."]
wait_time = 0.5 wait_time = 0.5
one_shot = true one_shot = true
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_Area2D_area_exited"]
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] [connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_Area2D_body_exited"] [connection signal="body_exited" from="Area2D" to="." method="_on_Area2D_body_exited"]
...@@ -4,7 +4,6 @@ export(PackedScene) var Mob ...@@ -4,7 +4,6 @@ export(PackedScene) var Mob
export(PackedScene) var Mob_LKW export(PackedScene) var Mob_LKW
signal won signal won
signal step_done_world
# The port we will listen to. # The port we will listen to.
const PORT = 9080 const PORT = 9080
# Our WebSocketServer instance. # Our WebSocketServer instance.
...@@ -14,8 +13,8 @@ var client_id ...@@ -14,8 +13,8 @@ var client_id
#var json = JSON.new() #var json = JSON.new()
export var deltaN = 0.001 export var deltaN = 0.001
#func _ready():
# set_camera_limits
var min_speed = 700 var min_speed = 700
var max_speed = 1100 var max_speed = 1100
var lines = [] var lines = []
...@@ -53,11 +52,9 @@ func _ready(): ...@@ -53,11 +52,9 @@ func _ready():
#Remove Control pannel to Optimize Image for Maschine learning #Remove Control pannel to Optimize Image for Maschine learning
# Connect base signals to get notified of new client connections, # Connect base signal to get notified of new client connections
# disconnections, and disconnect requests.
_server.connect("client_connected", self, "_connected") _server.connect("client_connected", self, "_connected")
#_server.connect("client_disconnected", self, "_disconnected")
#_server.connect("client_close_request", self, "_close_request")
# This signal is emitted when not using the Multiplayer API every time a # This signal is emitted when not using the Multiplayer API every time a
# full packet is received. # full packet is received.
...@@ -77,7 +74,7 @@ func _ready(): ...@@ -77,7 +74,7 @@ func _ready():
func prepareMap(): func prepareMap():
get_tree().call_group("mobs","queue_free") get_tree().call_group("mobs","queue_free")
#Random Choice of Map
if Input.is_action_pressed("map1"): if Input.is_action_pressed("map1"):
activeMap = 1 activeMap = 1
elif Input.is_action_pressed("map2"): elif Input.is_action_pressed("map2"):
...@@ -87,8 +84,10 @@ func prepareMap(): ...@@ -87,8 +84,10 @@ func prepareMap():
else: else:
activeMap = randi()%3+1 activeMap = randi()%3+1
#Coment in with Map of your Choice to supress Random
#activeMap = 3 #activeMap = 3
#Place Spawn points and Finish Line at chosen Map
if activeMap == 1: if activeMap == 1:
$Lane1Spawn.global_position = $map1Lane1Spawn.global_position $Lane1Spawn.global_position = $map1Lane1Spawn.global_position
$Lane2Spawn.global_position = $map1Lane2Spawn.global_position $Lane2Spawn.global_position = $map1Lane2Spawn.global_position
...@@ -113,6 +112,7 @@ func prepareMap(): ...@@ -113,6 +112,7 @@ func prepareMap():
$Finish_line/CollisionShape2D.global_position = $map3FinishLine.global_position $Finish_line/CollisionShape2D.global_position = $map3FinishLine.global_position
$StartTimer.start() $StartTimer.start()
#Move Car to spawn position and rotation
$Car.global_position = $PlayerSpawn.global_position $Car.global_position = $PlayerSpawn.global_position
$Car.global_rotation = $PlayerSpawn.global_rotation $Car.global_rotation = $PlayerSpawn.global_rotation
...@@ -232,7 +232,6 @@ func _close_request(id, code, reason): ...@@ -232,7 +232,6 @@ func _close_request(id, code, reason):
pass pass
# #
func _disconnected(id, was_clean = false): func _disconnected(id, was_clean = false):
# pass
# # This is called when a client disconnects, "id" will be the one of the # # This is called when a client disconnects, "id" will be the one of the
# # disconnecting client, "was_clean" will tell you if the disconnection # # disconnecting client, "was_clean" will tell you if the disconnection
# # was correctly notified by the remote peer before closing the socket. # # was correctly notified by the remote peer before closing the socket.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment