use new animations in button logic
This commit is contained in:
parent
f17a87de2e
commit
a576058b01
2 changed files with 7 additions and 8 deletions
|
@ -6,6 +6,7 @@ onready var timer
|
|||
var limit_random
|
||||
var rng = RandomNumberGenerator.new()
|
||||
onready var button = $"../Button/"
|
||||
export(Array, String) var animations = ["orange", "red"]
|
||||
|
||||
# True if animation should change
|
||||
var next = false
|
||||
|
@ -23,8 +24,6 @@ func _ready():
|
|||
func _process(delta):
|
||||
timer += delta
|
||||
|
||||
var animations = ["orange", "red"]
|
||||
|
||||
var max_frame = me.frames.get_frame_count(me.animation) - 1
|
||||
var current_anim_idx = animations.find(me.animation)
|
||||
if current_anim_idx >= animations.size() - 1:
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
extends Button
|
||||
|
||||
onready var villain = $"../Villain/AnimatedSprite"
|
||||
onready var villain_animations = $"../Villain".animations
|
||||
|
||||
var etat
|
||||
var etat = false
|
||||
const texture_pressed = preload("res://Assets/skin_assets/button_normal.png")
|
||||
const texture_released = preload("res://Assets/skin_assets/button_pressed.png")
|
||||
|
||||
|
@ -10,10 +11,9 @@ const texture_released = preload("res://Assets/skin_assets/button_pressed.png")
|
|||
# Called every frame. '_delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
if etat:
|
||||
match villain.get_frame():
|
||||
2:
|
||||
if villain.animation == villain_animations[1]:
|
||||
print("non")
|
||||
_:
|
||||
else:
|
||||
print("oui")
|
||||
else:
|
||||
print("caché")
|
||||
|
|
Reference in a new issue