Sonic-like jumping attack issue

  • 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!

  • The slightest hint would be very appreciated.

    Unless I'm trying to do something C2 can't do?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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.

  • 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.

    TL22:

    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 buddies

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