This commit is contained in:
dan
2025-03-22 20:21:52 -04:00
commit ea36511c71
63 changed files with 1992 additions and 0 deletions

8
scripts/coin.gd Normal file
View File

@@ -0,0 +1,8 @@
extends Area2D
@onready var aplayer = $AnimationPlayer
func _ready() -> void:
print("coin ready!")
func _on_body_entered(body:Node2D) -> void:
GameManager.add_point()
aplayer.play("pickup_sound")

1
scripts/coin.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://dafe64tmpvrbe

16
scripts/killzone.gd Normal file
View File

@@ -0,0 +1,16 @@
extends Area2D
@onready var timer = $Timer
func _on_body_entered(body:Node2D) -> void:
print("dead.")
body.get_node("CollisionShape2D").queue_free()
Engine.time_scale = 0.5
timer.start()
func _on_timer_timeout() -> void:
print("reloading")
Engine.time_scale = 1.0
get_tree().reload_current_scene()

1
scripts/killzone.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://db8xxth4oa6xg

41
scripts/playermovement.gd Normal file
View File

@@ -0,0 +1,41 @@
extends CharacterBody2D
@onready var mysprite = $AnimatedSprite2D
const SPEED = 100.0
const JUMP_VELOCITY = -250.0
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("jump") :
if is_on_floor():
velocity.y = JUMP_VELOCITY
# gets dir -1,0,1
var direction := Input.get_axis("move_left", "move_right")
#flip sprite
var flippy = direction<0
mysprite.flip_h = flippy
if is_on_floor():
if direction==0:
mysprite.play("default")
else:
mysprite.play("run")
else:
mysprite.play("jump")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()

View File

@@ -0,0 +1 @@
uid://dfmh1h3u1186s

24
scripts/slime.gd Normal file
View File

@@ -0,0 +1,24 @@
extends Node2D
const SPEED = 50.0
var direction = 1.0
@onready var ray_left = $raycastleft
@onready var ray_right = $raycastright
@onready var mysprite = $AnimatedSprite2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
print("slime..ready to eat.")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if ray_right.is_colliding():
direction = -1
mysprite.flip_h = true
if ray_left.is_colliding():
direction = 1
mysprite.flip_h = false
position.x += direction * SPEED * delta

1
scripts/slime.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://b3qxwn2ta73vx