Archived
1
0
Fork 0
This repository has been archived on 2026-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
Danmaku/client/danmaku!/player.gd

22 lines
496 B
GDScript

class_name Player
extends Node2D
@export var speed = 80
var velocity := Vector2.ZERO
func get_input():
if Input.is_action_pressed("Slow Mode"):
speed = 30
else:
speed = 80
velocity = Input.get_vector("Left", "Right", "Up", "Down") * speed
func _physics_process(delta: float):
get_input()
# Bounds checking
var attempted_position := position + (velocity * delta)
attempted_position = attempted_position.clamp(Vector2(0, 0), Globals.SERVER_SIZE)
position = attempted_position