Page 1 of 1

rapid fire attack 'stages'

PostPosted: Wed Jul 29, 2009 7:22 pm
by killwithpower
I have 3 animation 'stages' for my character when rapid firing. first is the startupfire (before the rapid fire starts), then I have the middlefire which is the animation that I want repeating during the rapid fire, then the endfire which is of course when you end rapid fire. I am doing this animation for him while standing still, walking and, jumping. I just don't know what I would put for code to do that or where to put the code. Any suggestions?

Re: rapid fire attack 'stages'

PostPosted: Wed Jul 29, 2009 11:53 pm
by skydereign
Okay, so you have three animation sets; standing, running, and jumping. Each has three animations, start fire, firing, end fire. To do this smoothly I would suggest a variable, though you can use built in ones. Create a variable called fireState, or some other. In this, I probably won't use fireState, as it will be for antimoonwalk regulation, which I won't go into here. If you need antimoonwalk code, I will need your .ged.

player -> KeyDown(fire button[Disabled]) -> Script Editor
Code: Select all
char* key = GetKeyState();
fireState=1;
if(key[KEY_RIGHT]==1 || key[KEY_LEFT]==1)
{
    //ChangeAnimation(running start);
}
if(jump==0)
{
    //ChangeAnimation(jump start);
}
if(key[KEY_RIGHT]==0 && key[KEY_LEFT]==0 && jump==0)
{
    //ChangeAnimation(stand start);
}


If you didn't know, the // means the line is commented out. Insert your ChangeAnimation there. Now you use a similar method for the animation finish. If the fire button is still pressed, increase fireState and change the animation to the rapid fire. Now the animation will repeat, until you let go of the fire button so add a keydown event, starting the end rapid fire animation. You can use the above method to determine the animation. Then on the animation finish of the end fire animations, switch to your normal. This, if implemented wrong, will most likely cause moonwalking, this is just a guideline. Again, if you want my help, I can edit your .ged.

Re: rapid fire attack 'stages'

PostPosted: Fri Jul 31, 2009 5:24 pm
by killwithpower
Here it is skydereign and thanks.

Oh, there are plenty of other glitches ... if any are easy fixes you could do those if you want too (but don't feel obligated). Thanks.

- KWP

Re: rapid fire attack 'stages'

PostPosted: Sat Aug 01, 2009 6:08 am
by killwithpower
Here are the other shot attacks.

Re: rapid fire attack 'stages'

PostPosted: Sat Aug 01, 2009 11:47 am
by skydereign
I always miss at least one thing, so if you find anything, tell me. This took a good amount of time, around 5 hours... This one took a lot longer as most antimoonwalk code that I have written for people only uses 12 state values. It uses 36 animation state values, it used to be 40, but I was able to reduce it. Essentially, all possible events for each animation is shown, the antimoonwalk code. It is a bit tedious, and not always the most efficient, but it is pretty easy to add things too. There are a lot of empty cases in most of the events, you can get rid of them if you want. Also, I changed all of the sprites, as it turns out, the pngs you did were still bmps, oh well. If you notice, the actor's height and width should always be 150. That is what I meant by fixing the sprites. Without further delay, here you go.

-Edit
I didn't fix some things, that were pretty easy, like wall sticking. There is also this glitch that sometimes does not register the collision that resets the jump animation, if this is a problem, I can fix those pretty easily. I'll wait though, just in case there is anything else that needs fixing.

Re: rapid fire attack 'stages'

PostPosted: Sat Aug 01, 2009 8:04 pm
by killwithpower
Awesome.

Re: rapid fire attack 'stages'

PostPosted: Sat Aug 01, 2009 10:28 pm
by skydereign
Sorry I can't do the rest. It should be easy enough, but we shall see. What you need to do is either use tiles, to define all of your walls and other, or make a collision event for each foreground wall. On side collisions, this code will make you not stick.
Code: Select all
double yvel = yvelocity;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1, 1, 0, 0);
yvelocity=yvel;


I really suggest learning how to use tiles, and then redo all foreground to be tiles, that way you have a universal actor for collisions. It is possible with the animations you have. One of the caveman gedt shows how to use them, if you need help. If you still don't get it, I can help explain.