How do I Enable/Disable collision (Not global to sprite)

0 favourites
  • 6 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi all

    Hopefully someone could help shed some light.

    Below is the intended flow:

    1) Ball rested on lower platform.

    2) Click to toss the ball.

    3) Ball land on upper platform.

    4) Spawn new ball on lower platform, previous ball(s) remain on the upper platform.

    I'm having difficulty with (4).

    Tried playing around by toggling collision/physics of both ball and platform, but couldn't get the result I want.

    Need help on this.

    Also, if you noticed anything that could be done more efficiently or things you would do differently in my project, feel free to comment!

    Would love to know how to better use Construct2.

    Download Dropbox

    dropbox.com/s/r2imm9iiuhy9e2v/ObjectTossPhysics%20-%20forum.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried using the behavior "Jump-thru" instead of "Solid" for the green platform?

  • Sorry I forgot to mention clearly that I'm using physics.

    I think Jump-thru doesn't work with physics? Or am I missing something.. still new in Construct 2

    Edit 1:

    Hmm I just saw this on the manual. Looks like it has to be done through the physics behavior?

    scirra.com/manual/98/physics

    [quote:355n3x5c]Another consequence is Physics won't respond to objects with the Solid or Jumpthru behaviors. These behaviors are totally redundant when using Physics and have no effect. Instead, use the Immovable property.

  • You are correct about physics not interacting with platformer/solid/jump through behaviors.

    In your current code, the issue with the inactive ball is that it is not set to stay in place.

    I would modify it so that inactive ball gets the immovable property as well. This way, they are still an obstacle, and give the visual impression to rest on the platform, when the platform is actually loosing its physics consistency to let the lower ball come through.

    I added a "Set physics immovable" in the "DIsableBall" function and a "Set physics movable" in the "Ball is Active" (event 4) of the main Event sheet and this seems to do the trick.

  • elafreat meant to suggest the platform behavior because you asked for an easy solution, and the platform is.

    But if you insist on using physics:

    https://drive.google.com/open?id=0B1SSu ... VQzbDIydm8

    I did't fill in all those text objects. Thats 4 you to do.

  • Kyatric

    Thanks for the suggestion! But I want the balls to remain their physics behavior, where they will still bounce away when hit by other balls.

    99Instances2Go

    Yeah I want the physics behavior for the interaction between balls.

    Your idea of using a dummy when tossing is great!

    Still in the middle of implementing it as I need to change quite a few things.

    But I think this is exactly what I needed

    The text objects were for debug purposes when I did my own projectile simulation..

    But soon realized that I want the physics behavior upon collision. So i dropped the whole thing.

    You were right to ignore them. haha.

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