Skip to content

Commit

Permalink
[add] flipbook animations to animation sample
Browse files Browse the repository at this point in the history
  • Loading branch information
begla committed Mar 10, 2024
1 parent c83039a commit a9650fe
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ AnimationSystem.load()
World.load()
Node.load()
Math.load()
FlipbookAnimation.load()

function OnActivate(entity)
local e = Entity.find_first_entity_with_name("knight")
Expand All @@ -46,6 +47,22 @@ function OnActivate(entity)

-- Keep track of time
Time = 0.0

-- Set up flipbook animations

-- Start with the dinosaur
e = Entity.find_first_entity_with_name("dino")
local fb = FlipbookAnimation.get_component_for_entity(e)
-- Play animation by setting the flags manually
-- Flag bit 1: Play, Flag bit 2: Loop, Flag bit 3: Clear
-- Bits: 0000 0111, Decimal: 7
FlipbookAnimation.set_property(fb, "Flags", Variant.from_uint8(7))

-- Set up the deer
e = Entity.find_first_entity_with_name("deer")
fb = FlipbookAnimation.get_component_for_entity(e)
-- Play animation by using the helper function
FlipbookAnimation.play(fb)
end

function Tick(entity, delta_t)
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit a9650fe

Please sign in to comment.