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

7 months ago
extends CharacterBody2D
@export var speed = 300.0
func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision:
7 months ago
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
7 months ago
else:
7 months ago
velocity.x = -velocity.x
collision_mask = 0
7 months ago
$Trail.shrinking = true
7 months ago
$Ricochet.play()