How do I: Shooting Mechanics and Animation states

Get help using Construct 2

Post » Sun Oct 26, 2014 6:56 pm

So I decided as a little test project I'd make a Megaman Boss battle (don't judge me XD). Everything is going great and I finally got my animation state logic down (I thought it would be easy but it was NOT lol) but my shooting mechanic is having a slight bug. See my shooting mechanic is that on left mouse click he shoots and sets a variable called shooting to 1 so the animation states will set the proper shooting animation(standing, running, jumping) it all works GREAT except that I have a condition that when he releases the mouse button it waits 2 seconds then sets shooting to 0 so it will switch to the normal (non shooting) animations. Thing is after shooting for a little while once I release the left mouse button he stops waiting 2 full seconds to switch the variable and just switches it to 0 immediately after release. I've tried EVERYTHING I can think of but none of it is working D: I'd love some help on this if at all possible.

turns out I can't share link for capx sorry D:
B
6
S
1
Posts: 6
Reputation: 418

Post » Sun Oct 26, 2014 7:27 pm

Why are you waiting the two seconds, for animation to finish its cycle?

Instead of the wait try using an On finished event that sets variable or just chooses next animation
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Sun Oct 26, 2014 9:52 pm

It worked :D except now when I'm running the shot is not spawning at the correct Image point even though I'm certain I'm giving it the correct one. Instead it's spawning at the origin which is at my feet D:
B
6
S
1
Posts: 6
Reputation: 418

Post » Mon Oct 27, 2014 12:20 am

Check ALL your image points, each frame has its own... you will need to make sure all the image points in all the frames are right.
I can't remember if there is an apply to all like their is in collision box menu...
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Mon Oct 27, 2014 12:35 am

That did it man! :D now it's shooting consistently at the same point :) now I just gotta figure out how to switch to normal animations after an interval of not shooting a la old megaman style. But seriously thanks alot for your help :)
B
6
S
1
Posts: 6
Reputation: 418

Post » Mon Oct 27, 2014 12:35 am

That did it man! :D now it's shooting consistently at the same point :) now I just gotta figure out how to switch to normal animations after an interval of not shooting a la old megaman style. But seriously thanks alot for your help :)
B
6
S
1
Posts: 6
Reputation: 418

Post » Mon Oct 27, 2014 12:48 am

How old.. NES Megaman had like 2 animations Run and Run and shoot, the rest were just frame poses, stand & shoot, jump, jump & shoot, fall (was just jump pose). :)
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Mon Oct 27, 2014 1:51 am

No I mean like I want him to switch to running animation without the buster up if he doesn't shoot for a certain given time.
B
6
S
1
Posts: 6
Reputation: 418

Post » Mon Oct 27, 2014 3:52 am

Set instance variable for Shooting = 0, change it to 1 when shooting button is pressed event runs and sets it back to 0 when shooting animation ends. Have an event running that compares instance variable Shooting = 0 & Arrow key pressed that start the running animation... so it always restarts the run animation even if the player is still holding down the arrow key.

You might have to tweak what frame to restart the running animation on so it is not as noticeable to the player as a total restart might be.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Mon Oct 27, 2014 4:47 am

I actually solved it a different way like 10 min ago (site was down for me so couldn't post) XD Here's what I did:

- When player fires set shooting to 3 (3 second time out)
-Whenever Left Mouse Button is not pressed
- Then while shooting > 0
- Every 1 second take 1 off shooting

And there we go :D :D :D :D :D it now smoothly transitions between shooting and not shooting for all animations with a time out :D but thanks so much for all your help man :)

PS: The fix was sooooooo dumb I literally commented on the logic: Fix was so stupid I feel dumb XD XD XD
B
6
S
1
Posts: 6
Reputation: 418


Return to How do I....?

Who is online

Users browsing this forum: David181, dop2000, namaewayukidesu and 13 guests