How do I Shooting Advanced shooting animation

Get help using Construct 2

Post » Mon Jun 12, 2017 11:15 pm

Good afternoon friends of scirra lovers of the creation of videogames, because the situation in which I find myself is that I create a basic animation for a platform game only aim and shoot pretty good by the way, I got it by watching the video tutorials of Jeremy Alexander (Jerementor), whom I thank infinitely for everything he teaches us. The question begins when I get a pretty good sprite which contains in your animation to shoot 4 frames. Aim with the weapon, the detonation and two more frames of the movement of the gun back. And the problem is that when I use the method of Jermentor only makes a frame and not see the other 3, I'm going crazy looking for how to achieve it but I still can not do it, beforehand I hope to excuse my English and hopefully some of the masters of This great forum could help me to solve this situation, greetings and in advance thanks.
B
16
S
4
G
1
Posts: 2
Reputation: 1,411

Post » Tue Jun 13, 2017 8:38 am

@alex3770

Is it that you want the bullet to spawn from the gun on the detonation frame (frame 1) rather than the 1st frame (frame 0)? If so, you could use something like this:

1. On shoot key pressed | set playing sprite animation "shoot" from start.
2 If sprite.animation "shoot" is playing, if sprite.animationFrame = 1 | spawn bullet from sprite at (gun origin).

You will need to add an origin point at the position of the barrel of the gun on the sprite, where you want the bullet to spawn from.

A word of warning about spawning the bullet partway through an animation: unless your animation is very quick and short (or you have a deliberately long wind-up phase for your shot) it is best to spawn the bullet at the first frame because otherwise you may be introducing a noticeable lag into the shooting mechanic, which can make the game feel unresponsive.

If this isn't what you're after please could you link to specific video you're talking about, or include a capx?
B
20
S
9
G
4
Posts: 473
Reputation: 4,260

Post » Tue Jun 13, 2017 12:49 pm

Message: alex3770 can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
mekonbekon wrote:@alex3770

Is it that you want the bullet to spawn from the gun on the detonation frame (frame 1) rather than the 1st frame (frame 0)? If so, you could use something like this:

1. On shoot key pressed | set playing sprite animation "shoot" from start.
2 If sprite.animation "shoot" is playing, if sprite.animationFrame = 1 | spawn bullet from sprite at (gun origin).

You will need to add an origin point at the position of the barrel of the gun on the sprite, where you want the bullet to spawn from.

A word of warning about spawning the bullet partway through an animation: unless your animation is very quick and short (or you have a deliberately long wind-up phase for your shot) it is best to spawn the bullet at the first frame because otherwise you may be introducing a noticeable lag into the shooting mechanic, which can make the game feel unresponsive.

If this isn't what you're after please could you link to specific video you're talking about, or include a capx?


Sure friend, look, in the first video I show something similar to what happened to me, I did not stay in that animation, but if you realize it only points and the shot goes out.

https://youtu.be/rBQ1eE7bKvA


Now I can solve it in a way, now the problem is that when I jump and keep pushing the button of shot they leave up to 4 shots and it does not look good that, apparently it is a simple bug and if it is needed more I can upload what you ask me To review it in the following video I leave a sample of what I'm talking about.

https://youtu.be/BIoW1WoselY
B
16
S
4
G
1
Posts: 2
Reputation: 1,411

Post » Wed Jun 14, 2017 9:18 am

@alex3770

Looking at the code from the first video, I think your problem may be that the event 2 "Is shooting" condition will trigger every tick until frame 3 is reached. Try adding a "Trigger once while true" to that event - you can combine them rather than making it a sub event but make sure it follows on from the "Is shooting" condition e.g.:

Event 2: obj_player | Is shooting | trigger once whilst true

Not:

Event 2: obj_player | trigger once whilst true| Is shooting

If you PM me the code I can confirm for you that this is the case.
B
20
S
9
G
4
Posts: 473
Reputation: 4,260

Post » Wed Jun 14, 2017 9:48 am

@alex3770

Sorry, that's not entirely correct - you'll need to make another change:

Events 4 -6 in your code should be under another main event:

obj_player is playing "ID_SHOOTING"

Adding the "trigger once" to Event 2 will prevent the ID_SHOOTING animation from triggering and resetting to normalAttackAnims every tick.
Adding the new main event means that the code will only check the animation frames while ID_SHOOTING is playing.
B
20
S
9
G
4
Posts: 473
Reputation: 4,260


Return to How do I....?

Who is online

Users browsing this forum: moebios and 4 guests