Replays in game

This commit is contained in:
gemdude46 2023-01-30 10:12:53 +00:00
parent 09c9809e94
commit 5031122edd
8 changed files with 59 additions and 29 deletions

View file

@ -2,10 +2,18 @@ extends Unit
var replay : ReplayRecording = null
export var replay_file: String
func _ready():
._ready()
replay = ReplayRecording.new()
replay.load_from_uri(replay_file)
func process_unit(delta : float, time_elapsed : float):
self.time_elapsed = time_elapsed
if replay != null:
if replay != null and replay.time_per_frame > 0:
handle_replay(time_elapsed)
func handle_replay(at_time: float):
@ -18,4 +26,4 @@ func handle_replay(at_time: float):
var index: int = sprite >> 3
sprite &= 7
set_sprite(sprite, index)
set_sprite(sprite, index, true)