Initial commit

This commit is contained in:
2025-05-23 10:58:01 +02:00
commit f23df0b1f8
34 changed files with 527 additions and 0 deletions

33
scripts/player.gd Normal file
View File

@@ -0,0 +1,33 @@
extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -800.0
var width
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
width = get_viewport().size.x
velocity.y = JUMP_VELOCITY * 2
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
else:
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
if position.x > width:
position.x -= width
elif position.x < 0:
position.x += width
move_and_slide()