Enemy issue

For questions about using Classic.

Post » Sat May 28, 2011 2:18 pm

I'm having trouble with an enemy. I have to fall on a specific part on what seems like a specific frame for it to register I'm hurting it. Or if I'm not falling I have to be practically half way inside of it for register that it should attack. Can someone please help.
B
3
G
1
Posts: 33
Reputation: 566

Post » Sat May 28, 2011 3:15 pm

Sounds like the a collision mask problem, can you post the cap/source?

Failing that, try changing the collision method from "per pixel" to "bounding box"
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat May 28, 2011 5:57 pm

I probably sound really stupid but how do you add a attachment? :oops:
B
3
G
1
Posts: 33
Reputation: 566

Post » Sat May 28, 2011 6:08 pm

The forums used to allow it, but I don't know if they do anymore. I'd recommend getting DropBox [url:10u49zcy]https://www.dropbox.com/home[/url:10u49zcy]
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat May 28, 2011 9:42 pm

Heres a CAP File
[url:2tmhqlg5]http://dl.dropbox.com/u/30677634/EnemyProblem.cap[/url:2tmhqlg5]
Yeah and it works slightly better in this cap than in the game but still only works half the time. :?
B
3
G
1
Posts: 33
Reputation: 566

Post » Sat May 28, 2011 9:45 pm

To be more specific I find that it usualy only works on the middle frame of the crawl animation when i hit the arc in the middle of it.
B
3
G
1
Posts: 33
Reputation: 566

Post » Sat May 28, 2011 10:36 pm

First off, don't use your character sprite to detect collisions. You should use your Pbox object.

Secondly, your worm animation is changing size much too dramatically to use Bounding Box collisions. You need to either use Per Pixel, or redesign your worm so it's more consistently uniform, and then give it a collision box similar to your player's Pbox.

Thirdly, you have some really odd conditions here, and I don't understand why you would need them:



Why is the worm's attack animation important in figuring out whether or not there is a collision? Why is the player sprite's angle important? You're trying to do too much at once in one event, and you're getting your order of events all wonky.

You need to think a bit more logically about how the attacks take place. As a general rule of thumb, when making your conditions you need to filter them from the very basic (two sprites colliding) at the top, and work your way down towards the more specific things (is an animation playing?) towards the bottom, or in your sub-events.

So, what is the very first thing that happens when checking for an attack? Two sprites collide, that's what. What next? Well, you need to know if the player is falling, or if he's just standing there. Etc. This other stuff either isn't important, or it's out of order, and that is the reason your combat is behaving so randomly.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat May 28, 2011 10:58 pm

[color=green:158habub]Thanks alot it's working better now.[/color:158habub]
Oh yeah and the reason the events look funny is because My actual game requires a few extra conditions that arent shown like if hes swinging a weapon.
Heres a fixed product of my example.
[url:158habub]http://dl.dropbox.com/u/30677634/EnemyProblem2.cap[/url:158habub]
B
3
G
1
Posts: 33
Reputation: 566

Post » Sun May 29, 2011 1:01 pm

Oh yeah I forgot to ask if anyone knew how to get my worm to stop traveling left and right while its going up. You can see the problem in my fixed example as well as the original.
B
3
G
1
Posts: 33
Reputation: 566


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest