PDA

View Full Version : Updated [2006-07-03] - Lua Animation Sample code



yaustar
July 2nd, 2006, 20:00
2006-08-09
Modified the code so if can be used more like a library.

Multiple sprites support, press circle to control another Ken.

2006-07-03 number 3:
You can now walk and attack etc.

2006-07-03 Again:
The code now supports multiple animations including an attacking animation

Sprites from: http://www.kikiroxxorz.com/sprites.php

2006-07-03:
The code now supports pausing the animation and reseting animation.

2006-07-02:
Here is a sample in how to do an animation in Lua using one image file.

There are some parts that can be done better and I may rework it in the future.

http://i6.tinypic.com/245c6d1.png

Zion
July 2nd, 2006, 23:05
nice sample. :D

gunntims0103
July 2nd, 2006, 23:24
great sample

MasterChafed
July 3rd, 2006, 05:03
thankyou, this allowed me to add animation to my Halo 2d game. Very helpful

jman420
July 3rd, 2006, 07:04
The only bad Practice I noticed in your code was the spelling of the word practises :D

other then that this has been helpful :D thanks!

acn010
July 3rd, 2006, 07:08
lol nice

yaustar
July 3rd, 2006, 16:15
Updated.

gunntims0103
July 3rd, 2006, 16:18
great this really helps

yaustar
July 3rd, 2006, 17:11
Updated again.

yaustar
July 3rd, 2006, 18:08
Last update of today.

Zion
July 5th, 2006, 17:02
thanks yaustar :D

D0N
July 5th, 2006, 17:07
Nice sample yaustar!

Apoklepz
July 10th, 2006, 17:41
Hey Yaustar. Good job helping out with this! I'm sure a lot of people here will pick up from this nice example. Anyways, I took a look at it and put the standing animation sprites in place for you....they looked a bit off at first, but I fixed them. Hope this'll help.

yaustar
July 10th, 2006, 17:42
Cheers for that. Much appreciated.

Apoklepz
July 10th, 2006, 17:48
Hey no problem.... BTW, I think I got his jump sprites somewhere in my HD... I can get em set up for this example if you'd like to put the code in it. Just lemme know, K?

yaustar
August 10th, 2006, 01:53
Updated again.

bronxbomber92
August 10th, 2006, 03:51
Very good work. I have yet to download it yet, but I don't understand how come he code is soo long for animation? Did you make it into a game almost?

yaustar
August 10th, 2006, 04:06
If you haven't downloaded it yet, how do you know the code is so long? :confused: . If you are takling about the time between updates then its because I was working on my other project (see GP2X section for Dance2x) and I felt I didn't need to update this snippet. Then I got bored :P

As well as the sprite/animation system, there is some code to manage the different states that an object can be in (eg walking, standing, attacking). So there is a small finite state machine there to deal with that.

I also have other little code snippets that you may like:
http://www.dcemu.co.uk/vbulletin/showthread.php?t=28540
http://www.dcemu.co.uk/vbulletin/showthread.php?t=29190

bronxbomber92
August 10th, 2006, 05:11
well, by looking at the dl size ( I know that includes images, but it still would appear long)...

yaustar
August 10th, 2006, 05:50
Its about 300-400 lines of code including whitespaces and comments.