Improved the frog and fixed minigame progression icon
This commit is contained in:
@@ -56,6 +56,10 @@ const full_lives_icon: = preload("res://assets/minigames/minigame_ui/graphic/lif
|
||||
@onready var animation_player: = $AnimationPlayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
model_progression_rect.texture = empty_progression_icon
|
||||
|
||||
|
||||
# ------------ Lock/Unlock ------------
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ signal flooded
|
||||
@onready var jump_area_collision: = $JumpArea/CollisionShape2D
|
||||
@onready var frog_area: = $FrogArea
|
||||
|
||||
var can_jump: = true
|
||||
var follow_mouse: = false
|
||||
var is_jumping: = false
|
||||
var land_area: Area2D
|
||||
@@ -45,6 +46,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
|
||||
func _jump(direction: Vector2) -> void:
|
||||
if not can_jump:
|
||||
return
|
||||
|
||||
_search_for_land_area()
|
||||
|
||||
# Checking if there is somewhere to land
|
||||
|
||||
@@ -90,6 +90,8 @@ func _create_tracks() -> void:
|
||||
track.stimuli = track_stimuli
|
||||
track.are_they_distractors = are_distractors
|
||||
track.top_to_bottom = i % 2
|
||||
|
||||
lilypad_tracks[current_word.GPs.size() - 1].cleared.connect(_on_last_lilypad_cleared)
|
||||
|
||||
|
||||
func _play_current_word() -> void:
|
||||
@@ -118,6 +120,15 @@ func _on_frog_flooded() -> void:
|
||||
track.restart()
|
||||
|
||||
|
||||
func _on_last_lilypad_cleared() -> void:
|
||||
frog.can_jump = false
|
||||
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
|
||||
frog.can_jump = true
|
||||
frog._jump(Vector2.RIGHT)
|
||||
|
||||
|
||||
func _on_end_area_area_entered(area: Area2D) -> void:
|
||||
if not area in end_areas:
|
||||
end_areas.append(area)
|
||||
|
||||
@@ -15,10 +15,7 @@ var stimulus: Dictionary:
|
||||
var is_distractor: = true:
|
||||
set(value):
|
||||
is_distractor = value
|
||||
if is_distractor:
|
||||
label.set("theme_override_colors/font_color", Color.BLACK)
|
||||
else:
|
||||
label.set("theme_override_colors/font_color", Color.WHITE)
|
||||
label.set("theme_override_colors/font_color", Color.BLACK)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extends Control
|
||||
|
||||
signal cleared
|
||||
signal disappeared
|
||||
|
||||
@export var lilypad_crossing_time: = 5.0
|
||||
@@ -10,7 +11,8 @@ const lilypad_class: = preload("res://sources/minigames/frog/lilypad/lilypad.tsc
|
||||
@onready var spawn_timer: = $SpawnTimer
|
||||
|
||||
var is_cleared: = false
|
||||
var stimuli: = []
|
||||
var stimuli: = []:
|
||||
set = _set_stimuli
|
||||
var are_they_distractors: = []
|
||||
var ready_to_spawn: = false
|
||||
var despawned_lilypads: = []
|
||||
@@ -22,6 +24,9 @@ var center_point: = Vector2.ZERO
|
||||
var lilypad_scale: = 1.0
|
||||
var top_to_bottom: = true
|
||||
|
||||
var last_stimuli: = []
|
||||
var potential_size: = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
for i in range(number_of_lilypad):
|
||||
@@ -33,12 +38,22 @@ func _ready() -> void:
|
||||
|
||||
lilypad.frog_land.connect(_on_lilypad_frog_land.bind(lilypad))
|
||||
lilypad.frog_fall.connect(_on_lilypad_frog_fall.bind(lilypad))
|
||||
|
||||
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if ready_to_spawn and stimuli.size() != 0:
|
||||
var index: = randi() % stimuli.size()
|
||||
_spawn_lilypad(stimuli[index], are_they_distractors[index])
|
||||
var potential_stimuli: = stimuli.duplicate()
|
||||
for stimulus in last_stimuli:
|
||||
potential_stimuli.erase(stimulus)
|
||||
|
||||
var index: = randi() % potential_stimuli.size()
|
||||
_spawn_lilypad(potential_stimuli[index], are_they_distractors[index])
|
||||
|
||||
last_stimuli.append(potential_stimuli[index])
|
||||
if last_stimuli.size() > potential_size:
|
||||
last_stimuli.pop_front()
|
||||
|
||||
|
||||
func disappear() -> void:
|
||||
@@ -118,6 +133,8 @@ func _on_lilypad_frog_land(lilypad: Node2D) -> void:
|
||||
spawn_timer.stop()
|
||||
ready_to_spawn = false
|
||||
is_cleared = true
|
||||
|
||||
cleared.emit()
|
||||
|
||||
|
||||
func _on_lilypad_frog_fall(lilypad: Node2D) -> void:
|
||||
@@ -145,3 +162,9 @@ func _on_resized() -> void:
|
||||
center_point = rect.size / 2.0
|
||||
|
||||
lilypad_scale = rect.size.x / 100.0
|
||||
|
||||
|
||||
func _set_stimuli(value: Array) -> void:
|
||||
stimuli = value
|
||||
|
||||
potential_size = max(0, min(stimuli.size() - 2, 4))
|
||||
|
||||
Reference in New Issue
Block a user