Skip to content

Commit

Permalink
time crystal conveyance part 1: locking animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Patashu committed Jul 12, 2023
1 parent 6360bcc commit 346a62d
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="516fa2e94f631d704a2931e2c9dd6842"
dest_md5="3688963b31cfdb555fb4f6d180eb8d2d"
source_md5="71da588b2e0213cef2057e710d841a99"
dest_md5="034946dc35b4a30d07856a73d0bd284c"

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="b8274f3fd0b8ec66a266e10eb4ea6000"
dest_md5="0593e853c32fd44040db007b7a357485"
source_md5="5babeb313334f031662666efcc8a31a3"
dest_md5="53bc5a62249172665f145e29035b68c1"

Binary file not shown.
4 changes: 2 additions & 2 deletions .import/LockingTime.png-8a90bb3707e91184994634605e627eaf.md5
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source_md5="07bdd5a62d8769836de85cbed165f190"
dest_md5="402c2ac12f3016fe5b8e0aeabf9e1c02"
source_md5="ce7c2c0264af5fa1a48169a700419f8b"
dest_md5="22aabdc05fe663784e0088691e88f7df"

Binary file modified .import/LockingTime.png-8a90bb3707e91184994634605e627eaf.stex
Binary file not shown.
Binary file modified assets/CrystalFrameAnimationP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/CrystalFrameAnimationPB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/LockingTime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions timeline/TimelineSlot.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,45 @@ var showing_fuzz = false;
var fuzz_timer = 0;
var locked = false;
var parent = null;
onready var crystalanimation : Sprite = get_node("CrystalAnimation");
onready var timelinesymbols : Node2D = get_node("TimelineSymbols");
onready var overlay : Sprite = get_node("Overlay");
onready var lockanimation : Sprite = get_node("LockAnimation");

var region_timer = 0;
var region_timer_max = 0;
var crystal_timer = 0;
var crystal_timer_max = 0;
var lock_timer = 0;
var lock_timer_max = 0;

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.

func lock_animation() -> void:
crystalanimation.visible = true;
crystalanimation.texture = preload("res://assets/CrystalFrameAnimationP.png");
crystalanimation.hframes = 15;
crystalanimation.frame = 0;
crystal_timer = 0;
crystal_timer_max = 0.5/crystalanimation.hframes;

func lock_animation_part_2() -> void:
crystalanimation.frame = crystalanimation.hframes - 1;
crystal_timer = 0;
crystal_timer_max = 0;
lockanimation.visible = true;
lockanimation.texture = preload("res://assets/LockingTime.png");
lockanimation.hframes = 5;
lockanimation.frame = 0;
lock_timer = 0;
lock_timer_max = 0.5/lockanimation.hframes;

func undo_lock_animation() -> void:
crystalanimation.visible = false;
lockanimation.visible = false;

func fill(buffer: Array) -> void:
for sprite in timelinesymbols.get_children():
parent.broadcast_remove_sprite(sprite);
Expand Down Expand Up @@ -188,9 +217,29 @@ func finish_animations() -> void:
region_timer = region_timer_max;
region_enabled = false;
offset = Vector2(12, 12);

if (crystal_timer_max > 0):
lock_animation_part_2();

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if (lock_timer_max > 0):
lock_timer += delta;
if (lock_timer >= lock_timer_max):
lock_timer -= lock_timer_max;
lockanimation.frame += 1;
if (lockanimation.frame + 1 == lockanimation.hframes):
lock_timer = 0;
lock_timer_max = 0;

if (crystal_timer_max > 0):
crystal_timer += delta;
if (crystal_timer >= crystal_timer_max):
crystal_timer -= crystal_timer_max;
crystalanimation.frame += 1;
if (crystalanimation.frame + 1 == crystalanimation.hframes):
lock_animation_part_2();

if (region_timer < region_timer_max):
region_timer += delta;
if (region_timer > region_timer_max):
Expand Down
9 changes: 9 additions & 0 deletions timeline/TimelineSlot.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ texture = ExtResource( 1 )
offset = Vector2( 12, 12 )
script = ExtResource( 2 )

[node name="CrystalAnimation" type="Sprite" parent="."]
visible = false
offset = Vector2( 12, 12 )

[node name="TimelineSymbols" type="Node2D" parent="."]

[node name="Overlay" type="Sprite" parent="."]
modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 3 )
offset = Vector2( 12, 12 )

[node name="LockAnimation" type="Sprite" parent="."]
visible = false
modulate = Color( 1, 1, 1, 0.8 )
offset = Vector2( 12, 12 )
7 changes: 2 additions & 5 deletions timeline/TimelineViewer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func lock_turn(turn_locked: int) -> void:
timelineslots.add_child(slot_to_move);
# TODO: animate slot texture changing
slot_to_move.fuzz_off();
slot_to_move.texture = preload("res://assets/TestCrystalFrameP.png");
slot_to_move.lock_animation();
slot_to_move.locked = true;
finish_divider_position();
finish_slot_positions();
Expand All @@ -119,10 +119,7 @@ func undo_lock_turn() -> TimelineSlot:
# We know which turn we most recently locked, it's the one at the bottom - so just move it back
var slot_to_move = timelineslots.get_child(timelineslots.get_children().size()-1);
# no animation since this is a meta undo function only
if (is_heavy):
slot_to_move.texture = preload("res://timeline/timeline-slot-heavy-24.png");
else:
slot_to_move.texture = preload("res://timeline/timeline-slot-light-24.png");
slot_to_move.undo_lock_animation();
# TODO: fancy animation of slots sliding
# if it's empty, move it just after max_moves.
if (slot_to_move.timelinesymbols.get_children().size() == 0):
Expand Down

0 comments on commit 346a62d

Please sign in to comment.