Git Product home page Git Product logo

animatedsprite's People

Contributors

didiermalenfant avatar electronicsarchiver avatar squidgoddev avatar whitebrim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

animatedsprite's Issues

drawTiled() compatibility?

Seeubg that the default way to add images is through an imagetable, is there a way to add images as drawTiled images instead?

Combining sprites?

Would there be any way to combine sprites somehow? Let's say I have a character sprite with some different frames for body movements, and then a second sprite for facial expressions...

Initialize directly with path?

I'm curious as to why the initializer takes an imagetable instead the the path string itself. Is there a common use case for keeping a reference to the imagetable outside the sprite? As it stands, it feels like one unnecessary line of setup code.

To avoid a breaking API change, you could do something like:

if type(imagetableOrPath) == "string" then
  self.imagetable = gfx.imagetable.new(imagetableOrPath)
else
  self.imagetable = imagetableOrPath
end

Support for time-based frame advancement

This utility is fantastic, but its utility is limited by the fact that it only supports frame-based animation. Although switching to time-based animation would likely require a fair amount of work, the approach seems relatively straightforward given that you could use a playdate.graphics.animation.loop to handle the frame tracking. Its properties seem well positioned to provide everything you'd need to support the current JSON config and API as it is today.

Technically this would be a breaking change and could impact some games when compiled against the new version, though you could minimize that significantly by setting a default delay on the loop object based on playdate.getFPS().

Extend AnimatedSprite Class?

This may be more a question rather than a bug report.
I like to have my sprites in a separate class for each. I nonetheless couldn't manage to extend this class, is there a good way to do it?
Thank you

add onAnimationStartEvent

Hi - maybe I'm wrong but there seems to be no event called when animation starts ?
In my case that would be quite handy as I'm animating a muzzle flash which should disappear from the screen when animation ends (basically using setVisible(false) method of a sprite class.

It looks like this (thought that maybe onStateChangedEvent is gonna be called after each playAnimation() but apparently not:

local bang = gfx.imagetable.new( "images/fx/muzzleFlash1_01" )
self.bangAnim = AnimatedSprite.new( bang )
self.bangAnim.states.default.onAnimationEndEvent = function (self) self:setVisible(false) end
-- unfortunately  not called after each playAnimation() call:
-- self.bangAnim.states.default.onStateChangedEvent = function (self) self:setVisible(true) end

-- something like this would be helpful:
-- self.bangAnim.states.default.onAnimationStartEvent = function (self) self:setVisible(true) end
end

Or am I missing some other obvious way of achieving this "one-shot" (pun intended) animations that do not stuck at displaying last frame when animation is finished ?

:setScale doesn't work

Hello ! It looks like the :setScale method isn't working on AnimatedSprite. Is that a playdate limitation or just something that's missing ?
Thanks for making this library I look forward for more information !

Memory leak in AnimatedSprite ?

Hello @Whitebrim !
I am using AnimatedSprite for a game I am making where there are some sprites (around 30 max) that are animated.
Unfortunately, it look likes there is a memory leak when updating animations every frame... I don't know how specific this is to my code but what I can show you is the stats window of the device (I ran the game on device to check real performances).
Device stats

I have looked into the profiler and determined that this indeed comes from calling updateAnimation() every frame.
One thing though, I am not making a class to create objects, I am just storing objects in a table and I have function that creates them like a class because for some reason Playdate SDK won't allow to extend a class from a class that already is extended from something.

I'll be glad to provide more informations and even contribute to AnimatedSprite. Looking forward to your answer and have a nice day !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.