Sonic-like jumping attack issue

Get help using Construct 2

Post » Tue Jul 24, 2012 1:26 am

Hey there!

I'm trying to make my physics character able to double-jump but the double-jump should be an attack if an enemy is nearby.

So I check the distance:

Distance(char.x,char.y,enemy.x,enemy.y) < 300 = attack
Distance(char.x,char.y,enemy.x,enemy.y) > 299 = double-jump

Only I can't figure out how to make sure the player jumped before allowing the attack and how to tell when the player is NOT jumping.
I tried setting a variable JustJumped to 1 when I jump, but how can I tell the game the physics character is on the ground to set the var back to 0?... without using insane collision checking on all ground sprite in the level.

Also, If I just walk by an enemy the distance becomes < 300 so my char. attacks instead of jumping.

Any idea?

Also, is it a bad idea to use a physics character. Could I emulate a sonic-like ball destroying physics objects on its way with a platform behavior instead?

Thank you!
TheDev2012-07-25 00:47:23
Posts: 41
Reputation: 407

Post » Wed Jul 25, 2012 12:48 am

The slightest hint would be very appreciated.
Unless I'm trying to do something C2 can't do?
Posts: 41
Reputation: 407

Post » Wed Jul 25, 2012 1:30 am

Why do you not want to use a ground collision check and why do you think its insane? Is it because you have many different types of ground sprites?
Posts: 51
Reputation: 18,702

Post » Wed Jul 25, 2012 1:51 am

It's insane because he's using physics simulation?

As far as whether you should just use platform behavior and forgo physics... it depends on what kind of game you want to make. If you're making a Sonic clone or sidescrolling platformer of some kind, I'd recommend not using physics and instead going the platformer behavior route. Much easier to accomplish this specific task.
Posts: 307
Reputation: 10,285

Post » Sat Jul 28, 2012 1:20 am

Thanks for your replies guys.

Rockman: Yes.
A typical level I'm making has around 200 ground sprites divided into 7 types of sprites. It was my understanding that the game does coll checks only on those on-screen. Am I right? There are never more than 20 of these sprites at once on-screen, and still, I get 1-3fps using Cocoon on a slow 600mhz mobile device.

It would be very nice to have a feature for the physics behavior that simply checks if there's ANYTHING underneath the player. Without having to do collision checks with every instance of a sprite.
Also, if physics could interact with a simple solid object.

I want to make use of physics destruction. Nothing crazy because I want it to run at 30fps on a iPhone2 but still I want it to feel like it's not as rigid as a platformer. Do you think a ball-rolling type of game can properly be emulated using only the platformer behavior?
If so, what about interactions with physics objects? I don't want to have to apply both the solid and physics behavior to my ground sprites.

Thanks buddiesTheDev2012-07-28 01:28:00
Posts: 41
Reputation: 407

Return to How do I....?

Who is online

Users browsing this forum: 20170217, alajajm, hyem, Lancifer, Per3za and 8 guests