Attack animations for enemies

For questions about using Classic.

Post » Tue Dec 09, 2008 5:03 pm

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.
B
2
G
4
Posts: 9
Reputation: 1,068

Post » Tue Dec 09, 2008 5:28 pm

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... :mrgreen:
*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.
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Tue Dec 09, 2008 5:31 pm

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!
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Wed Dec 10, 2008 1:43 am

[quote="Ashley":2pixp4uh]albeit with a broken overlap system.[/quote:2pixp4uh]

Does that mean it's getting updated?! :D :D :D
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Wed Dec 10, 2008 2:02 am

I meant his events... whats wrong with the overlap condition in Construct?? :?
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Wed Dec 10, 2008 2:19 am

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 :oops: )
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

[url:z834rtjh]http://www.mediafire.com/?wzhrxggjnew[/url:z834rtjh]

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 :)
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Wed Dec 10, 2008 2:22 pm

Actually, I may have just fixed it :O
Once again due to my own sloppy code ;)
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Thu Dec 11, 2008 7:00 am

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...
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Thu Dec 11, 2008 8:19 am

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
B
3
S
2
G
5
Posts: 351
Reputation: 2,377

Post » Thu Dec 11, 2008 3:44 pm

Oh maybe I confused you :mrgreen:
*edit* Maybe I confused myself LOL
But actually I think I nailed it, se hyv!
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests