Animation 2

Blitz3D Forums/Blitz3D Beginners Area/Animation 2

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Your sprite animation is made up by 8 frames: 0-3 for walking right, 4-7 for walking left.

In your code, you use always the frame for right walking, in fact the statement used to change the frames is:
frmman=( frmman + 1 ) Mod 4


The above statement makes the values for frmman going from 0 to 3.

If you want to use also the frames for left animation, you should add 4 to the calculated frame, so that it goes from 4 to 7.
frmman=( frmman + 1 ) Mod 4 ;0 <---> 3
frmman = frmman + 4 ; 0+4 <---> 3+4


Of course, you have to decide when to use the left frames, and when to use the right ones.

In your code, you can easily achieve that, if you use the direction variable 'dir', which is set to 1 for going right, and -1 for going left. So you could do so:
[EDITED]
Global frame ;put this in your variable declaration
.
.

frame=( frame + 1 ) Mod 4
if dir = -1 then
frmman = frame + 4
else
frmman = frame
endif


Hope this has sense for you,
Sergio.