added the game

This commit is contained in:
JHDev2006
2025-09-13 16:30:32 +01:00
parent 5ef689109b
commit 3773bdaf64
3616 changed files with 263702 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
extends PowerUpState
var fireball_amount := 0
const FIREBALL = preload("res://Scenes/Prefabs/Entities/Items/Fireball.tscn")
func update(_delta: float) -> void:
if Global.player_action_just_pressed("action", player.player_id) and fireball_amount < 2 and player.state_machine.state.name == "Normal":
throw_fireball()
func throw_fireball() -> void:
var node = FIREBALL.instantiate()
node.character = player.character
node.global_position = player.global_position - Vector2(-4 * player.direction, 16 * player.gravity_vector.y)
node.direction = player.direction
node.velocity.y = 100
player.call_deferred("add_sibling", node)
fireball_amount += 1
node.tree_exited.connect(func(): fireball_amount -= 1)
AudioManager.play_sfx("fireball", player.global_position)
player.attacking = true
await get_tree().create_timer(0.1, false).timeout
player.attacking = false