Animated tiles using s̶p̶a̶w̶n̶ ̶s̶p̶r̶i̶t̶e̶s̶ functions

  • If everything is like in my capx, I don't see why it wouldn't work. However, without your capx it's hard to really see what's going on.

    I'll post it when I get home from work, it was exactly the same, I just have more tiles. It looks like I changed the math to suit, but nothing moves.

    Make animTick static.

    Static, you say?

  • Yep, nice catch A local variable get reseted to its default value every tick. Making it static will make it work as if the variable was global, but retain its local scope.

    Also, Zebbi, keep in mind this system is not framerate independent, I believed you should use wallclocktime instead of tickcount to increment animTick.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yep, nice catch A local variable get reseted to its default value every tick. Making it static will make it work as if the variable was global, but retain its local scope.

    Also, Zebbi, keep in mind this system is not framerate independent, I believed you should use wallclocktime instead of tickcount to increment animTick.

    EDIT: Changed to global and it works! It was just the viewport layer was set wrong, I ALWAYS make this mistake!

    Out curiosity, can you switch out tickcount for wallclocktime in just one expression? I believe I already have a variable for changing wallclocktimeold to wallclocktimecurrent if there's a difference, but doing it in one line would be much handier.

  • You can't really switch those out. wallclocktime is incremented by dt every tick, the easiest thing would probably be using this dt directly.

    Like this :

    In this image, animTick is incremeted 4 times per second.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)