ft (wip): molecular stage prey
This commit is contained in:
21
evolve-die-repeat/molecular/molecular_player.gd
Normal file
21
evolve-die-repeat/molecular/molecular_player.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Area2D
|
||||
|
||||
@export var speed = 400
|
||||
var screen_size
|
||||
|
||||
func _ready():
|
||||
screen_size = get_viewport_rect().size
|
||||
|
||||
func _process(delta):
|
||||
var velocity = Vector2.ZERO
|
||||
if Input.is_action_pressed("move_right"):
|
||||
velocity.x += 1
|
||||
if Input.is_action_pressed("move_left"):
|
||||
velocity.x -= 1
|
||||
if Input.is_action_pressed("move_down"):
|
||||
velocity.y += 1
|
||||
if Input.is_action_pressed("move_up"):
|
||||
velocity.y -= 1
|
||||
|
||||
position += speed * velocity * delta
|
||||
position = position.clamp(Vector2.ZERO, screen_size)
|
||||
Reference in New Issue
Block a user