Help with Zelda-Like Attacking

Get help using Construct 2

Post » Fri Jan 25, 2013 7:09 pm

Hey all. I've been trying to get a 2d Zelda-style attacking system (with mouse-aiming) to work, but the sword seems to randomly not make collision with enemies. It only registers a collision about 30% of the time.

Here's the commented capx, if anyone would like to help; thanks!: http://dl.dropbox.com/u/68722177/test.capx
B
5
Posts: 7
Reputation: 339

Post » Fri Jan 25, 2013 9:27 pm

I took a look at your capx and you've made some unique choices for the way you have setup your game and there might be some ways to simplify what's going on.

For the sword swinging i'd recommend simply creating an animation of a sword swinging over a few frames in photoshop or whatever, then shape its collision box in the shape of a pie slice.

Have the pie piece always aim towards which way the mouse is pointing, and then use "on mouse clicked" play animation "swing" then
have a second event that looks to see if it hit a bad guy.
you can make it visible/invisible as needed.
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Fri Jan 25, 2013 9:33 pm

That would technically "work", but it's not an exact solution.

In 2d Zeldas (excluding the NES/Gameboy titles), the sword deals damage when it makes contact with the enemy during the swing arc, not when the enemy is simply in range of the attack.
B
5
Posts: 7
Reputation: 339

Post » Fri Jan 25, 2013 10:02 pm

under your collision event sheet change "sword - on collision with beebot"
to "sword - is overlapping another object (beebot)" and it works.

to help with debugging i noticed that the top right bee would only die when being struck with the very tip of the sword. so if the player is right on top of the bee and swinging there is no collision to detect, the sword spawns already on top of the bee.
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Fri Jan 25, 2013 10:23 pm

Worked like a charm - Thanks!

And thanks for the debug explanation, as well!
B
5
Posts: 7
Reputation: 339


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt and 21 guests