Looking for "Animation using tables" template or guide.

I have been searching all evening and can't seem to find a guide or template. Anyone by chance have a link?

Thanks!

Comments

  • quantumsheepquantumsheep Member Posts: 8,188

    I made a quick demo for you, based on what I'm using in my new game.

    You'll notice the first 6 columns of the table hold text variables. This is because we need to use the name of the graphic.

    The 7th column are a bunch of traitors.

    Sorry, the 7th column is used for speed. It's a 'real' number, so we can use values less than 1 for faster animations.

    In the actor you'll notice that we have a timer, but we're using the tablecellvalue instead of a number. The number it's picking is in column 7 of the table.

    The timer will increase the value of self.Anim by 1 every (column 7 value) seconds.

    Self.Anim is a self attribute on that particular actor - it’s in the left column under the actor’s colour, positions, size etc.

    We start this off at 1. If self anim is greater than 6, we reset it to 1. This makes the animation loop.

    the graphic is then constrained to the text value of the graphic in each column 1-6, with self.anim dictating the name of the image.

    There are probably much better ways of doing it, but this works for me!

    Hope that’s clear!

    QS =D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • CrestwoodCrestwood Member Posts: 80

    Mr Sheep, thank you very much!

    So simple, and I was making it very complicated.

    This will save me hours of work.

  • quantumsheepquantumsheep Member Posts: 8,188

    No problem!

    As I mentioned, there's probably a better way, but I have all the info I need in one table for my aliens in my new game.

    I limited the animations to six frames, so the first six columns use that as seen in the demo.

    The next column is for the animation speed.

    But in my game, there are columns for colour (r, g, b values), speed of movement, all sorts of things.

    Additionally, I have a level variable which goes up by 1 each time you finish a level.

    This is then used by each alien to check which level they're on, and having got that number, they can use each row of the table.

    This way I can put different values into each row for each level.

    It's how I've relatively easily been able to make 100 levels!

    Tables are incredibly powerful. I hope this helps you see that, and gets you on the right road to using them effectively in future!

    QS =D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.