Attack animations for enemies

This forum is currently in read-only mode.
From the Asset Store
Zombie attack is a survival game, where you have 2 types of games: Killer and survival.
  • Hi there. This is my first time posting, but I've been learning to use Construct and lurking on these forums for a while now.

    Anyway, I hope this hasn't been covered already, since I looked over this forum and I also haven't seen it in any games I've played made with Construct, but I wanted to have enemies perform an attack animation when they get close to the character. For the current enemy, that involves stopping his walk cycle, swinging his sword and then resuming his walk cycle.

    The main problem I am having currently is that the code doesn't differentiate between the various enemies for purposes of attacking, so if the character moves near one of them, they all swing their sword. Is there a simple fix for this?

    Again, sorry if this has already been addressed in another thread. My cap can be found here.

    Also, sorry for the lack of background, white boxes around characters, etc... I am fixing that all up as I come to it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh! Use the "For each object" (it is under system)

    So basic code will look like:

    For Each Enemy

    Enemy is close to player (whatever event you are using)

    Enemy Attack

    Sleipnir, the horse of Odin...

    *edit*

    Nevermind, I see ow you have this setup. You have a left and right detector for each skeleton's side, so that doesn't work.

    I will get back to this, have to get cracking on my final... ><

    Oh, for the skeleton's attack animation, one thing I do that isn't the "proper" way, but works, is to use the biggest animation frame as the template for each animation's size. In other words, make your largest animation frame a solid blue, then copy it for each other animation you have. Paste the other animations over that template, then they are all the same shape when you paste them into construct. Then delete the blue stuff but keep them all the same size. Use numpad 5 to center all the hotspots, and VOILA! (does that makes any sense?)

    BTW looks like it'll be cool. My first thought was METROID! then I saw her jump. METROID! LOL

    *edit AGAIN*

    Didn't see Ashley's post. Follow his orders. He is teh smarts one.

  • Normally conditions pick the related objects, so 'Player overlaps enemy' picks the one enemy the player is overlapping and any enemy actions apply to just that object. However, since you're using an intermediate detector-object, this is getting in the way of that process (ie. when you say detector overlaps enemy, effectively that is true for all enemies, because all enemies have a detector).

    You're trying to do what containers do, albeit with a broken overlap system. Read up on that article. As soon as you put the enemy in a container with its detector, things start working better already (hopefully you can fix it from there).

    Hope that helps!

  • albeit with a broken overlap system.

    Does that mean it's getting updated?!

  • I meant his events... whats wrong with the overlap condition in Construct??

  • Well it may not actually be broken, but in my iso game engine, i can't seem to get jumping on top of things working properly, mostly cause they have to use the overlapping condition. I think i made a thread about it a while ago but nobody responded

    It's probably my code (sorry to OP for hijacking post )

    Anything wrong with these events?

    I've tried doing things like a 'for each terrain' etc, but basically, whatever my code, if it has an overlapping statement in it, when the player's 'footprint' is overlapping two or more collision detectors, sometimes it acts oddly, like the way i've coded it (i hope) it's supposed to pick the object with the highest height variable and then the new 'ground level' becomes that of the highest one that the player is higher than. But sometimes the new ground level won't be updated until the player STOPS overlapping the shorter obstacles, resulting in enabling the player to be able to jump inside larger obstacles. I thought it was a picking error that had something to do with the order that the obstacles were created but i could be wrong.

    I'll post the cap again i suppose, it's been updated a little anyway

    http://www.mediafire.com/?wzhrxggjnew

    Anyways, to avoid further hijacking of the OP's post you could PM me or I could start another thread or you might be able to find the old thread i made

    Thanks

  • Actually, I may have just fixed it :O

    Once again due to my own sloppy code

  • hey arcticus can you share some of that jump on enemy code? I've been trying to perfect my setup and want a little comparison...

  • I have jump on enemy code? Heheh, well if i made an example a while ago it was hypothetical but i can only imagine i would do it similar to how i did it in the cap up there ^^^

    Did you want the player to lock on to the enemy's position or not? cause then you would probably have to have 2 variables for the player that store the enemy's X and Y components and then make it so when the player is on the enemy, change his X and Y comp's to the enemy's ones stored in the private variables.

    If you really want i could try and make something

  • Oh maybe I confused you

    *edit* Maybe I confused myself LOL

    But actually I think I nailed it, se hyv��!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)