Add bottom area limits
This commit is contained in:
parent
40525022d7
commit
200ae7f262
22 changed files with 300 additions and 40 deletions
|
@ -6,8 +6,6 @@ signal hit_ball
|
|||
signal ball_starts_colliding
|
||||
signal ball_stops_colliding
|
||||
@export var speed = 120
|
||||
@onready var animation_player = $AnimationPlayer
|
||||
@onready var sprite = $Sprite2D
|
||||
@onready var tile_map: TileMap = get_parent()
|
||||
|
||||
func _ready():
|
||||
|
@ -19,21 +17,21 @@ func get_input_direction():
|
|||
|
||||
func flip_sprite():
|
||||
if Input.is_action_pressed("move_left"):
|
||||
sprite.flip_h = true
|
||||
$Sprite2D.flip_h = true
|
||||
elif Input.is_action_pressed("move_right"):
|
||||
sprite.flip_h = false
|
||||
$Sprite2D.flip_h = false
|
||||
|
||||
func play_idle_animation():
|
||||
animation_player.play("idle")
|
||||
$AnimationPlayer.play("idle")
|
||||
|
||||
func play_walk_animation():
|
||||
animation_player.play("walk")
|
||||
$AnimationPlayer.play("walk")
|
||||
|
||||
func play_hit_ball_animation():
|
||||
animation_player.speed_scale = 0.8
|
||||
animation_player.play("hit_ball")
|
||||
await animation_player.animation_finished
|
||||
animation_player.speed_scale = 1
|
||||
$AnimationPlayer.speed_scale = 0.8
|
||||
$AnimationPlayer.play("hit_ball")
|
||||
await $AnimationPlayer.animation_finished
|
||||
$AnimationPlayer.speed_scale = 1
|
||||
|
||||
func _on_area_2d_body_entered(_body):
|
||||
# As player’s Area2D only collide with balls
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue