How do I do this sequence?

Get help using Construct 2

Post » Mon Jul 11, 2016 2:38 pm

I saw this game: https://www.instagram.com/p/BHehJ8ohmXK/ (Land of Fire by PixelComet)

I was just wondering, how I can implement this sequence where if enemies are right next to or close to each other, an animation kicks in and hits enemies for combos.

ps (sorry for the instagram link, only one i can find of said animation sequence).
B
28
S
11
G
15
Posts: 47
Reputation: 9,533

Post » Mon Jul 11, 2016 3:50 pm

The easiest way to do something like this would be to have an invisible "detector" or "helper" sprite that is around your character... Then if the player hits an enemy, and another enemy is within his "detector" then he will just move on to hit the next one.

You would need to have some sort of Boolean instance variable to tell the player if an enemy has already been hit in the combo so he doesn't continuously hit the same enemy again and again... then the boolean could reset for each enemy after the player is no longer attacking.

So your events would look something a little like;

[For each enemy (loop)]
[Player "attack" animation is playing]
[Player "attack" animation is on last frame]
[Enemy HasBeenHit.variable = 0]
[Enemy is overlapping "detector"]
--- Set player position X -> lerp(player.x,enemy,x-(player.width+enemy.width),1-0.3^dt)
--- Set player position Y -> lerp(player.Y,enemy.Y,1-0.3^dt)
--- Deal damage to enemy
--- Set enemy.HasBeenHit.variable to 1
--- Set player animation to "Attack" play from beginning

This example would only work on an attack going left to right, but it should give you the rough idea to get something started. :)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474

Post » Mon Jul 11, 2016 4:28 pm

@soldjahBoy thank you! I actually started to try this and my algorithm is almost exactly like yours (except for the lerp parts). I'll definitely try to figure this out. Thanks again for your kind response! :)
B
28
S
11
G
15
Posts: 47
Reputation: 9,533

Post » Mon Jul 11, 2016 4:32 pm

No problem!

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
83
S
34
G
40
Posts: 3,032
Reputation: 30,474


Return to How do I....?

Who is online

Users browsing this forum: Apollo14 and 27 guests