level 3
This commit is contained in:
+9
-1
@@ -12,6 +12,7 @@ extends CharacterBody2D
|
||||
@onready var shrink_sound = $shrinkSound
|
||||
@onready var die_player = $diePlayer
|
||||
@onready var music = %Music
|
||||
@onready var timer_fire = $timer_fire
|
||||
|
||||
|
||||
const SPEED = 130.0
|
||||
@@ -36,6 +37,7 @@ var crawl = false
|
||||
var fire = false
|
||||
var toucht_velocity = Vector2.ZERO
|
||||
var t_velocity = 0
|
||||
var can_fire = 0
|
||||
|
||||
@export var fireball_prefab : PackedScene
|
||||
|
||||
@@ -101,7 +103,8 @@ func _physics_process(delta):
|
||||
velocity.y = JUMPt_velocity
|
||||
|
||||
# check fireball
|
||||
if is_flower and (Input.is_action_just_pressed("flower") or fire):
|
||||
if is_flower and (Input.is_action_just_pressed("flower") or fire) and can_fire < 2:
|
||||
can_fire += 1
|
||||
fire = false
|
||||
var instance = fireball_prefab.instantiate()
|
||||
get_parent().add_child(instance)
|
||||
@@ -110,6 +113,7 @@ func _physics_process(delta):
|
||||
instance.linear_velocity.x = -200 if animated_sprite_2d.flip_h else 200
|
||||
instance.linear_velocity.y = 50
|
||||
instance.angular_velocity = 0
|
||||
timer_fire.start()
|
||||
|
||||
|
||||
# get input
|
||||
@@ -216,3 +220,7 @@ func _on_pipe_timer_timeout():
|
||||
|
||||
func _on_pipe_timer_half_timeout():
|
||||
position = pipe_target
|
||||
|
||||
|
||||
func _on_timer_fire_timeout():
|
||||
can_fire = 0
|
||||
|
||||
Reference in New Issue
Block a user