ft: prey collision

This commit is contained in:
2025-12-20 00:03:13 +01:00
parent a5055a523f
commit 1a532a5afb
16 changed files with 66 additions and 135 deletions

View File

@@ -1,14 +1,14 @@
extends CharacterBody2D
@export var speed = 400
@export var speed = 200
var screen_size
var str = 1
var damage = 1
func _ready():
screen_size = get_viewport_rect().size
func _process(delta):
var velocity = Vector2.ZERO
velocity = Vector2.ZERO
if Input.is_action_pressed("move_right"):
velocity.x += 1
if Input.is_action_pressed("move_left"):
@@ -18,5 +18,6 @@ func _process(delta):
if Input.is_action_pressed("move_up"):
velocity.y -= 1
position += speed * velocity * delta
move_and_collide(speed * velocity * delta)
#position += speed * velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)