Page 1 of 1
Animation question please help
Posted:
Sun Jun 20, 2010 2:41 pm
by krenisis
Ok I have 10 animations for a background actor. Lets say the name of the animations is res 1 o10. I need when i press the up button the animation changes in number order. Like if I press up once the animation changes to res2 if I press up again it changes to re3 and so on.
Re: Animation question please help
Posted:
Sun Jun 20, 2010 3:59 pm
by Bee-Ant
- Add "res_number" variable (integer) on Background
- Background Keydown->Up:
- Code: Select all
char AnimName[16];
res_number++;
sprintf(AnimName,"res%i",res_number);
ChangeAnimation("Event Actor", AnimName, FORWARD);
- Background Keydown->Down:
- Code: Select all
char AnimName[16];
res_number--;
sprintf(AnimName,"res%i",res_number);
ChangeAnimation("Event Actor", AnimName, FORWARD);
- Background->DrawActor:
- Code: Select all
res_number=max(1,min(res_number,10)); //to keep the res value from 1 to 10
Re: Animation question please help
Posted:
Sun Jun 20, 2010 7:52 pm
by krenisis
Thanks bee-ant because I was going crazy trying to figure it out.
Re: Animation question please help
Posted:
Sun Jun 20, 2010 8:07 pm
by Bee-Ant
It's just a matter of time
I was the same thing...
Re: Animation question please help
Posted:
Sun Jun 20, 2010 9:17 pm
by krenisis
Ok I put the code in but for some reason its not moving here is the demo with your code in place.
Re: Animation question please help
Posted:
Sun Jun 20, 2010 9:28 pm
by Bee-Ant
Your background animation names are :
- rs1
- rs2
- rs3
- etc...
So, you have to edit this line : (on Keydown)
- Code: Select all
sprintf(AnimName,"res%i",res_number);
to :
- Code: Select all
sprintf(AnimName,"rs%i",res_number);
Re: Animation question please help
Posted:
Sun Jun 20, 2010 9:31 pm
by krenisis
Ok i made the change but now once i press up one time the screen goes black
Re: Animation question please help
Posted:
Sun Jun 20, 2010 9:54 pm
by Bee-Ant
Move "des" away from view...
Look at des->Collision...
it would destroy anything it touch, no wonder when the BG gets bigger it turned into black
Re: Animation question please help
Posted:
Sun Jun 20, 2010 9:59 pm
by krenisis
Ok i was saying to myself what all those commands for it just to disapper!!! i could have done it simpler....then i look my destroy actor was there...i started to laugh at myself.
Re: Animation question please help
Posted:
Mon Jun 21, 2010 2:36 am
by lllllsp1d3rlllll
see thats funny cous i was trying to do that same very thing before and i figure out a neet way to do it
if actor animation lets say 1 animation name is 1
if actor animation =1
play animation 2
if actor animation = 2
play animation 3
so u play a animtion on by one by pressing the same button down matiple times
i know the codes not correct but just a instance