Updating Animations and "Collect Tapes" Feat
Add character animation frames for jump_down, jump_up, and sword attacks Adding collect tapes feature and centered phonephreak scene with error feedback.
This commit is contained in:
1 parent
8687a9e784
commit
e953fd862c
352 files changed
+14070
-35
No files matched your search
+24
-8
@@ -22,11 +22,12 @@ const PhoneSounds = [
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$Led.modulate.a = 0.0
|
||||
GloblaData.level += 1
|
||||
var origin = Vector2(150, 225)
|
||||
var offset = Vector2(135, 120)
|
||||
$Button0.position.y = origin.y + 3 * offset.y + 3 * -10
|
||||
$Button0.position.x = origin.x + 1 * offset.x + 2 * -5
|
||||
var origin = $ButtonOrigin.position
|
||||
var offset = Vector2(126, 125)
|
||||
$Button0.position.y = origin.y + 3 * offset.y
|
||||
$Button0.position.x = origin.x + 1 * offset.x
|
||||
$Button0.move_to_front()
|
||||
buttons.append($Button0)
|
||||
for i in range(0, 9):
|
||||
@@ -37,8 +38,8 @@ func _ready() -> void:
|
||||
label.text = "%s" %(i+1)
|
||||
var rect: ColorRect = b.get_child(1)
|
||||
rect.color = Color.from_rgba8(255, 255, 255, 0)
|
||||
b.position.y = origin.y + col * offset.y + row * -10
|
||||
b.position.x = origin.x + row * offset.x + col+1 * -5
|
||||
b.position.y = origin.y + col * offset.y
|
||||
b.position.x = origin.x + row * offset.x
|
||||
b.pressed.connect(_on_button_pressed.bind(i+1))
|
||||
buttons.append(b)
|
||||
b.name = "Button%s" %(i)
|
||||
@@ -55,15 +56,28 @@ func reset():
|
||||
var item = randi() % len(PhoneSounds)
|
||||
pieces.append(item)
|
||||
to_play.append(item)
|
||||
|
||||
var _tween: Tween
|
||||
|
||||
func wrong():
|
||||
if _tween and _tween.is_valid() and _tween.is_running():
|
||||
return
|
||||
_tween = $Led.create_tween()
|
||||
_tween.set_loops(3)
|
||||
_tween.tween_property($Led, "modulate:a", 1.0, 0.15)
|
||||
_tween.tween_property($Led, "modulate:a", 0.0, 0.15)
|
||||
_tween.finished.connect(reset)
|
||||
|
||||
func right():
|
||||
get_tree().change_scene_to_file("res://scenes/levels/level_%s.tscn" % GloblaData.level)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if guessed.size() >= pieces.size():
|
||||
if guessed == pieces:
|
||||
get_tree().change_scene_to_file("res://scenes/levels/level_%s.tscn" % GloblaData.level)
|
||||
right()
|
||||
else:
|
||||
reset()
|
||||
wrong()
|
||||
|
||||
if !$AudioStreamPlayer.playing and !to_play.is_empty():
|
||||
actuate_button(to_play.pop_front())
|
||||
@@ -74,6 +88,8 @@ func _process(delta: float) -> void:
|
||||
rect.color = Color.from_rgba8(255, 255, 255, rect.color.a8 - 5)
|
||||
|
||||
func _on_button_pressed(button: int) -> void:
|
||||
if guessed.size() >= pieces.size():
|
||||
return
|
||||
guessed.append(button)
|
||||
actuate_button(button)
|
||||
|
||||
|
||||
Reference in new issue
Block a user