Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Sprite Looping Back Then Fowrard   Message List  
Reply | Forward Message #13809 of 15019 |
Hello I am looping 24 sprite animations and for some reason they are not
looping right. It is a sprtie
of captin America Walking, the first 12 are him walking fowar and the other 12
are him walking
backward.

I have them split up in numbers, like

if(!(*KEYS & KEY_RIGHT) && !(frames%5)) // if right key is pressed
{
if(captin.activeFrame < 11)
{
captin.activeFrame++;
sprites[0].attribute2 = captin.spriteFrame[captin.activeFrame];
}

if(captin.activeFrame == 11)
{
captin.activeFrame = 0;
}

if(captin.x < 220)
{
captin.x++;
}


}

frames++;

/*
if(!(*KEYS & KEY_LEFT) && !(frames%5)) // if left key is pressed
{

if(captin.activeFrame < 22)
{
captin.activeFrame++;
sprites[0].attribute2 = captin.spriteFrame[captin.activeFrame];
}

if(captin.activeFrame == 23)
{
captin.activeFrame = 11;
}

if(captin.x > 0)
{
captin.x--;
}
}

I want it to loop through the first twelve when you press right and the last
tweleve when you press left,
but all it does no matter if I press left or right just do one forward then one
backward, one foward then
one back one. I have also tride to making a direction int to control when a
certain direction is pressed it
does something but that doesn't work







Mon Mar 10, 2003 11:33 pm

kreedskulls
Offline Offline
Send Email Send Email

Forward
Message #13809 of 15019 |
Expand Messages Author Sort by Date

Hello I am looping 24 sprite animations and for some reason they are not looping right. It is a sprtie of captin America Walking, the first 12 are him...
JC Matthews
kreedskulls
Offline Send Email
Mar 11, 2003
9:59 am

Hello, Don't know quite what you were trying to do but I hope this helps some. // frames 0-11 = walk RIGHT // frames 12-23 = walk LEFT if (RIGHT key pressed) {...
Martin Gibbins
gibbsteruk
Offline Send Email
Mar 12, 2003
9:24 am

... I have spotted one of the problems, at least. Lets say you initially press the 'right' key. At the end of the frame, captin.activeFrame is somewhere ...
Mat Scales
mscales@...
Send Email
Mar 12, 2003
9:25 am

you forgot the conditions press right (having been going left) so captin.activeFrame > 11 ... From: "JC Matthews" <kreedskulls@...> To:...
Mike Wynn
mike.wynn@...
Send Email
Mar 12, 2003
9:25 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help