mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-12 08:43:08 +00:00
* gdformat . * Lint code - Part 1 * Format code - Part 2 * Lint code - Part 2 Trying to fix the max allowed line length errors * Add normal_map_invert_y to the image .import files Because of Godot 3.4 * Do not call private methods outside of the script's scope Lint code - Part 3 * Format code - Part 3 * Fixed more line length exceeded errors - Lint code Part 3 * Export array of licenses - Lint code part 4 * Clean hint_tooltip code from Global Removes a lot of lines of code * Create static-checks.yml * Fix FreeType's license
42 lines
1.1 KiB
GDScript
42 lines
1.1 KiB
GDScript
extends Node2D
|
|
|
|
var frame: int = 0
|
|
onready var animation_timer: Timer = $AnimationTimer
|
|
|
|
|
|
func _draw() -> void:
|
|
var current_project: Project = Global.current_project
|
|
if frame >= current_project.frames.size():
|
|
frame = current_project.current_frame
|
|
|
|
$AnimationTimer.wait_time = (
|
|
current_project.frames[frame].duration
|
|
* (1 / Global.current_project.fps)
|
|
)
|
|
|
|
if animation_timer.is_stopped():
|
|
frame = current_project.current_frame
|
|
var current_cels: Array = current_project.frames[frame].cels
|
|
|
|
# Draw current frame layers
|
|
for i in range(current_cels.size()):
|
|
var modulate_color := Color(1, 1, 1, current_cels[i].opacity)
|
|
if i < current_project.layers.size() and current_project.layers[i].visible:
|
|
draw_texture(current_cels[i].image_texture, Vector2.ZERO, modulate_color)
|
|
|
|
|
|
func _on_AnimationTimer_timeout() -> void:
|
|
var current_project: Project = Global.current_project
|
|
if frame < current_project.frames.size() - 1:
|
|
frame += 1
|
|
else:
|
|
frame = 0
|
|
|
|
$AnimationTimer.set_one_shot(true)
|
|
$AnimationTimer.wait_time = (
|
|
Global.current_project.frames[frame].duration
|
|
* (1 / Global.current_project.fps)
|
|
)
|
|
$AnimationTimer.start()
|
|
update()
|