Want to contribute? Fork me on Codeberg.org!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
487 B

extends CharacterBody2D
@export var speed = 300.0
func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision:
var collider = collision.get_collider()
var pos = collision.get_position()
if abs(pos.y - collider.global_position.y) > collider.get_node("CollisionShape2D").shape.size.y * collider.global_scale.y / 2 - 0.001:
velocity.y *= -1
else:
velocity.x = -velocity.x
collision_mask = 0
$Trail.shrinking = true
$Ricochet.play()