enhancement: halve velocity when bouncing
This commit is contained in:
@@ -65,7 +65,7 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
if global_position.x >= max_x && velocity > 0:
|
if global_position.x >= max_x && velocity > 0:
|
||||||
if bounce:
|
if bounce:
|
||||||
velocity = -(velocity)
|
velocity = -(velocity)/2
|
||||||
print("velocity negated, bouncing")
|
print("velocity negated, bouncing")
|
||||||
global_position.x = 999
|
global_position.x = 999
|
||||||
time_since_first_location = -1
|
time_since_first_location = -1
|
||||||
@@ -74,7 +74,7 @@ func _process(delta: float) -> void:
|
|||||||
|
|
||||||
elif global_position.x < min_x && velocity < 0:
|
elif global_position.x < min_x && velocity < 0:
|
||||||
if bounce:
|
if bounce:
|
||||||
velocity = -(velocity)
|
velocity = -(velocity)/2
|
||||||
print("velocity negated, bouncing")
|
print("velocity negated, bouncing")
|
||||||
global_position.x = 1
|
global_position.x = 1
|
||||||
time_since_first_location = -1
|
time_since_first_location = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user