hold A animation and release animation for projectile

stevenshepherd

New member
I am open to different ideas, but right now I have it set up so that you hold A and then when you release A, you shot your projectile.

In this case, it is a fishing rod that casts. You release A and the projectile goes a set distance, stops, changes animation, and then disappears after a set amount of time (this is all set up in the action steps using timers etc).

What I would like is that when you hold A, there is a change/windup animation where she is getting ready to cast, and then releasing A trigger a new animation (holding the rod forward) and triggers the projectile.

I tried to make it so that getting ready to cast was my melee, and assigned to hold A, and then my projectile assigned to release A. Presumably that would get me part way there, but all kinds of funky things happen, like the projectile never shoots or appears, and the melee is all off, even though I set its offset.

So that is as far as I got. Basically I need

1) Hold A = casting wind up animation
2) Release A = triggers "holding fishing rod" animation, and triggers projectile

Down the road I'll also need to make it so that when the projectile is on the screen (i.e., the fishing bait is in the water), she either can't move until a timer runs our, or the player can cancel it by pressing A. Also will need to make it tile specific where the animation changes depending on whether or not the projectile hits land or water....but that seems like a future problem to figure out.

Thanks for any help anyone can offer me! :)
 

jorotroid

Member
That roughly sounds like it should have worked. Can you give a screenshot or gif of what is happening? You're saying that you just used the Melee and Projectile code that came with NESmaker as is, right? One thing that stands out is that you say Hold A. While technically the player is holding A, for this action you would want it set to Press A. Basically, Press A happens when the button is pressed; while Hold A will keep executing over and over again while you are holding A. So if it looks like the wind up animation is rapidly starting over and over again, then that is probably one of your problems.
 

stevenshepherd

New member
Thanks for the reply. That is what is happening, and it seems to create a new object repeatedly as well which leads to slowdown until it destroys itself.

The only issue is that i did actually want it to be Hold A to mimick the "winding up" of casting a fishing rod. Also it ensures that i can make two commands wirh one button that should sync up together. The idea is you hold A to wind up the cast and releasing it kills that animation and starts the projectile. If it was just press A, then either the wind up animation would be too short to even see, or if i made it longer, then the projectile would start while the player was in the "winding up to cast" animation, which wouldn't make a lot of sense.
 
You can make the action happen on the Press A, and still have the player expectation to hold it. An A release will start the "Cancel" animation.
 

jorotroid

Member
Ok, I think I understand what some of your problems are. It sounds like you are following the tutorials (that's not the problem) which means that you probably set up the attack state of the player to return to idle after its animation ends. Go to the action step for the "melee attack" and make sure animation is set to loop. But you will probably have another problem with the fishing rod. You probably also set the rod to destroy itself when its animation ends. That means that the rod may disappear while you are winding and before you get a chance to cast. You can also set it to loop (and you should), but this will bring in a new problem of the fishing rod sticking around forever and when you wind up again, it will make a duplicate rod. To solve this, you're going to need to do a few modifications to the code:

-First go into the Project Settings and click on the last tab which is User Variables.
-Add a new variable. Call it something like fishing_rod_object.
-Now go into the melee script. Find where the CreateObject line is. After that line, type in STX fishing_rod_object
-Click Save.
-Now go to the projectile script.
-You can probably put this at the beginning:
Code:
LDX fishing_rod_object
DestroyCurrentObject

-Click save.

I think this should solve your problem; but I am not at my computer at the moment and I am doing this off the top of my head. I could have easily forgotten a step.

One thing I don't understand about what you wrote is how you said the projectile is starting while the player's winding animation is still going. If you have a casting animation action, that should have been triggered when you released the button which also creates the projectile.
 
Top Bottom