feat: integrated some assets and made a hitbox and damage reaction system
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 5s
Create tag and build when new code gets to main / Export (push) Successful in 2m5s

This commit is contained in:
2025-08-01 17:17:00 +02:00
parent 44f083fbce
commit 6e017197f6
26 changed files with 484 additions and 449 deletions

View File

@ -12,15 +12,15 @@ var jump_velocity = 400.0
var gravity_modifier = 1
@onready var knight: AnimatedSprite2D = $Knight
@onready var red_hood: AnimatedSprite2D = $RedHood
@onready var base: AnimatedSprite2D = $Base
var animated_sprites = []
var is_in_cutscene = false
var is_in_cutscene = true
var current_animation = "idle"
func play_anim():
for sprite in animated_sprites:
for sprite: AnimatedSprite2D in animated_sprites:
sprite.play(current_animation)
func play_anim_run():
@ -49,7 +49,7 @@ func look_right():
func _ready() -> void:
animated_sprites = [
knight,
red_hood
base
]
func _physics_process(delta: float) -> void:
@ -62,30 +62,30 @@ func _physics_process(delta: float) -> void:
if not is_on_floor():
velocity += get_gravity() * delta * gravity_modifier
# Handle jump.
# if Input.is_action_just_pressed("ui_accept") and is_on_floor():
# velocity.y = -jump_velocity
var direction := Input.get_axis("move_left", "move_right")
if direction > 0:
look_right()
if direction < 0:
look_left()
if velocity.x != 0:
play_anim_run()
else:
play_anim_idle()
if direction:
var smoothed_speed = speed * smoothstep(0, 1, acceleration)
velocity.x += direction * smoothed_speed
velocity.x = clampf(velocity.x, -speed, speed)
if not is_on_floor():
current_animation = "got_hit"
else:
velocity.x = move_toward(velocity.x, 0, speed)
if velocity.x != 0:
play_anim_run()
else:
play_anim_idle()
if is_on_floor():
if direction:
var smoothed_speed = speed * smoothstep(0, 1, acceleration)
velocity.x += direction * smoothed_speed
velocity.x = clampf(velocity.x, -speed, speed)
else:
velocity.x = move_toward(velocity.x, 0, speed)
move_and_slide()
func _on_dialogue_manager_dialogue_ended() -> void:
set_in_play()