Animate or Change Self.image every 1 second?

quick question: what is the best option that doesn't kill the frame rate? Animate or change attribute, self.image with a timer?

thanks

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    I'd just use animate.
  • KangavarkKangavark Member Posts: 62
    thanks @Braydon_SFX
    Animating 10 images at 2 fps kept me at a smooth 60 fps, whereas changing the image every 0.5 seconds made it dip down to as low as 18 fps!
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    thanks @Braydon_SFX
    Animating 10 images at 2 fps kept me at a smooth 60 fps, whereas changing the image every 0.5 seconds made it dip down to as low as 18 fps!
    Animating at 2 fps and changing the image every 0.5 seconds . . . . are pretty much the same thing so should really give a similar performance.

    I've got stuff animating at 30 fps - as well changing images (change attribute self.image) at around 60 fps - and the game itself still runs at 60 fps.

    How big are your images ?
  • KangavarkKangavark Member Posts: 62


    How big are your images ?
    huge--they are the title screen of my game, each at 2048 x 1536 for resolution independence.
  • SocksSocks London, UK.Member Posts: 12,822
    huge--they are the title screen of my game, each at 2048 x 1536 for resolution independence.
    8-X Well ! It all makes sense now ! lol!

    Does the whole image animate or just one section ?
  • KangavarkKangavark Member Posts: 62

    Does the whole image animate or just one section ?
    It's really just a section. The words of the title swap colors every 0.5 seconds, and I have 10 variants that end up looping. There's probably an easier way...but as long as I'm still around 60 fps, I'm good to go.
  • SocksSocks London, UK.Member Posts: 12,822
    @Kangavark
    It's really just a section. The words of the title swap colors every 0.5 seconds, and I have 10 variants that end up looping. There's probably an easier way...but as long as I'm still around 60 fps, I'm good to go.
    You could simply have the animation word/s as a separate element sat against the larger full screen image (which would only need to be a still), 10 (variants) x 2048 x 1536 is a lot of unnecessary pixels, it might play @ 60 fps but it's going to be slower to load and make your app larger than it needs to be.
  • KangavarkKangavark Member Posts: 62
    @Socks

    ...yeah...you're right...if there was a "begrudgingly admit you're right" emoticon, I'd use it now. :)

    But, if I have 4 words x 10 variants each--even though they'll be much smaller than the BG (let's say 800x500), but still, that's 40 actors being cycled through simultaneously--is that really more efficient?
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013


    But, if I have 4 words x 10 variants each--even though they'll be much smaller than the BG (let's say 800x500), but still, that's 40 actors being cycled through simultaneously--is that really more efficient?
    Yes! :)

    800 x 500 x 4 = 1,600,000 px

    2048 x 1536 = 3,145,728 px


    (Also only 4 actors are being 'cycled' simultaneously)
Sign In or Register to comment.