How do I set and play attack animations on landscape games

Get help using Construct 2

Post » Wed May 28, 2014 12:56 am

Hey there

I've been working on an isometric-view game for a while, and I still can't manage to get the attack animations working correctly. They always get stuck on the first frame, so I would like to know if I'm doing anything wrong. I'll attach a screenshot of the event sheet for now, since some of the assets still need to be worked on and I would rather not share the capx until then.

If it's possible, I would also like to know how to spawn an object (in this case, a bullet) with a small delay after the start of the attack animation.

I'm sincerely sorry for not being able to share the capx, but I trust this screenshot is good enough information for you folks.

(FYI: The "Stop animation" in event #22 isn't affecting the attack animations as far as I know. It's just there to make sure the walking animation stops before the attack animation begins. I tried deleting it and the outcome was the same)
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234

Post » Wed May 28, 2014 1:48 am

Try the following:

1) Remove the Stop animation from event 22 (it is not needed and it might cause problems after all)
2) Add the condition "Is not Attacking" (add the "Is Attacking" and invert it) on the event 15.

Also, make sure that the speed of the animations isn't 0.

As for the spawning, either add a "Wait" action in your events and after that add the "spawn an other object" action, or if you want the spawned object to come out from a specific place at a specific frame,

1) go into the animations
2) find that frame
3) add an image point to where you want the object to be spawned from
4) create a new event and as a condition add the "compare frame" = to the frame you want
5) add the "spawn an other object" action (don't forget to choose the correct image point)
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Wed May 28, 2014 5:13 pm

Alright, here's the updated event screen. Made some changes of my own so the character would stand still while shooting, and the animation is working correctly now (thanks to your tips, of course). However, even if I disabled 8Direction while shooting, I can still make the character look to the left, down and up, which pauses the animation and makes it start over in the new direction. Also, the character is shooting way too many bullets per attack, as if it had some sort of burst-fire mode selected. Made some changes to make it fire less projectiles but it's still shooting way too many. Is there any way to limit the attack to 1 bullet?
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234

Post » Wed May 28, 2014 6:52 pm

You want your character to stop moving when he is firing right?
If so, you don't have to use the disable/stop 8direction movement (event 23) Instead add a "X IsAttacking" condition as event 2 and nest the (current) events 2,3,4 and 5 as sub-events. You should have then:

if Player "X IsAttacking"
-------Keyboard Down Arrow is down ----> Simulate 8direction pressing Down
-------Keyboard Right Arrow is down ----> Simulate 8direction pressing Right
...

As for the rapid fire, just add the "Trigger once while true" condition on the event 23 (together with the "IsAttacking")
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Wed May 28, 2014 9:58 pm

It didn't work, sadly. I can move while attacking and then the character gets stuck in his first walking frame whenever he's standing still. Don't worry though, my temporal fix is still working fine so I can continue testing everything else.

What did work, however, was the rapid fire fix. I had to put "Trigger once while true" on event 25 though, since putting it in 23 made the "spawn another object" event useless.

By the way, the bullet only goes to the right at the moment. What do you recommend in order to make it go up, left and down, accordingly? Right now the bullet is set to spawn at the third (#2) animation frame. I suppose I should try to use "set angle" to change its trajectory, or should I create a new object with a mirrored/upside-down bullet?


I apologise for the tardiness in my reply. I wasn't home, but please keep in mind I'm very interested in getting this to work and I appreciate your help.
B
4
Posts: 17
Reputation: 234

Post » Thu May 29, 2014 12:27 am

You are doing something wrong. It should work and it is wiser to check the variables than constantly disabling/enabling the behaviors.

You are right about the trigger once, the advices were from my head, I didn't suspected that.

I think this is what you want. I've altered one of my examples that is lurking somewhere in the forums, in order to fit your instructions. Tell me if something doesn't work as it should. ;)
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Thu May 29, 2014 1:37 pm

I compared your capx with my project, and for some reason, even after doing the same changes, the character still moves while attacking. I really don't know why this is happening.

Here's an updated version of all movement events. I seriously can't spot what's causing this.
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 17
Reputation: 234

Post » Thu May 29, 2014 6:44 pm

@EightMan I haven't tried setting actions while comparing to an animation frame, but you can try adding a System - Every X.X seconds in event 30, try with somethin like 0.3.

Also, maybe you should try checking for the IsAttacking variable on all your movement events (5,6,7,8) and removing event no. 4. Besides, you are setting the IsAttacking variable on "W is pressed" and everything else to "X is Down", pressed and down are different.

I can't give it a try right now but, hope that helps.
B
21
S
5
G
3
Posts: 53
Reputation: 3,335

Post » Thu May 29, 2014 7:04 pm

Have you disabled the default movement on the 8direction properties..? I think that this is the culprit.

On a different note, I remember that placing the bullet creation above the direction conditions solved some double firing problems. If you encounter this, move the event 29 just below event 24 (in essence, make it the first sub-event).

@donelwero the sub-event 30 ensures that the triggering happens at the correct frame and it's fps independent. The every x seconds is somewhat abstract and inaccurate.
Also the "Is NOT attacking on event 4 is checked first and only when it holds true the following sub-events execute. The "is pressed" and "is down" on this matter are irrelevant.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Fri May 30, 2014 2:05 am

Alright, that fixed it!

Thanks a lot man. I learned a lot with this.

By the way, since we're here, could you point me to any enemy attack animation tutorials? I made an enemy that is supposed to stop and attack just like the playable character, and I'd like to know if anyone else has made enemies that move in only 4 directions and attack from up close (which I assume should be done with Pathfinding but I could be wrong).
B
4
Posts: 17
Reputation: 234

Next

Return to How do I....?

Who is online

Users browsing this forum: jaytrott86, Yahoo [Bot] and 7 guests