This repository has been archived on 2023-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
Boups/Characters/Villain.gd

40 lines
739 B
GDScript3
Raw Normal View History

2023-02-25 01:04:08 +01:00
extends Node2D
onready var me = $AnimatedSprite
onready var timer
2023-02-25 14:02:57 +01:00
var limit_random
var rng = RandomNumberGenerator.new()
onready var button = $"../Button/"
2023-02-25 01:04:08 +01:00
# Called when the node enters the scene tree for the first time.
func _ready():
timer = 0
rng.randomize()
limit_random = rng.randi_range(2, 10)
2023-02-25 01:04:08 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
timer += delta
match me.get_frame():
0:
# Vert
if timer >= limit_random:
timer = 0
limit_random = rng.randi_range(2, 10)
me.set_frame(1)
1:
# Orange
if timer >= .5:
timer = 0
me.set_frame(2)
2:
# Rouge
if timer >= 2:
timer = 0
me.set_frame(0)
_:
print("Not handled frame")