1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-21 23:54:23 +00:00

🐞 Fix ScrollingBlock being pushed back by the player

This commit is contained in:
Steffo 2020-10-03 20:53:58 +02:00
parent fb70634b66
commit e18345ab2a
3 changed files with 3 additions and 9 deletions

View file

@ -9,6 +9,7 @@ extents = Vector2( 20, 20 )
[node name="ScrollingBlock" type="KinematicBody2D"] [node name="ScrollingBlock" type="KinematicBody2D"]
collision_layer = 8 collision_layer = 8
collision_mask = 2 collision_mask = 2
motion/sync_to_physics = true
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."] [node name="Sprite" type="Sprite" parent="."]

View file

@ -6,7 +6,4 @@ export(Vector2) var scroll_velocity: Vector2 = Vector2(-10, 0)
func _physics_process(delta): func _physics_process(delta):
# FIXME: This doesn't really work... Any other things we could try? position += scroll_velocity * delta
var collision = move_and_collide(scroll_velocity * delta)
if collision:
print(collision)

View file

@ -60,8 +60,4 @@ func _physics_process(delta):
if Input.is_action_pressed("plr_right"): if Input.is_action_pressed("plr_right"):
movement += Vector2.RIGHT * move_speed movement += Vector2.RIGHT * move_speed
player_move(movement) move_and_slide(movement, up_normal)
func player_move(movement):
move_and_slide(movement, up_normal())