Crate Gravity Problems

This forum is currently in read-only mode.
From the Asset Store
Collection of crates game sprites including a explode animation
  • I have a problem where crates won't fall if one is stacked on another. They have a custom movement behavior telling them to move down if they're not overlapping a solid, but if you destroy one below two others the other two will stay floating in the air.

    Download

  • Have it so it only checks to see if it's overlapping a solid below it, or else it will overlap things above it and just 'float' there.

  • How do I do that?

  • I have Just had a look at your cap, and would recommend that you use the 'Physics' behavior instead of 'Custom' for moving your crates. This will save you having to write extra collision detecting events, and will make your game look more realistic.

    Step by step for crates

    1, Remove the 'Custom movement for the crates and replace it with the 'physics' behavior.

    2, In the crates settings, tick the use 'Gravity' box.

    3, in the crates settings, set 'Collisions' to 'Bounding box'.

    4, In the spite editor, move the crates collision point to the center of the box (12x12)

    Step by step for the floor

    1, Assign the 'Physics' behavior to the floor(to stop the crates falling through it)

    2, DONT tIck the use 'Gravity' box for the floor, for obvious reasons.

    3, In the floors properties settings, tick the box that says, 'Immovable'

    4, in the floors properties settings, tick the box that says "solid"

    5, In the Event editor, remove any leftover event lines concerning the crates custom movement.

    if i have left anything out, or it doesn't work, you can download an amended cap here-

    http://dl.dropbox.com/u/15858089/Partial%20ex%28gravity%29.cap

    Good luck

  • I was thinking of using the physics behavior, but then it's a pain to make every object it interacts with a physics object aswell.

  • I was thinking of using the physics behavior, but then it's a pain to make every object it interacts with a physics object aswell.

    You don't have to make everything else a 'Physics' object. You can create a 1 sprite that using the 'Physic's' behavior, create an event that makes it invisible when the game runs and place multiple copies of it in your level where you need it (resizing the sprite as you go, not in the picture editor)

    Anyway post a cap when you have finished the game....I think i have got a copy of the original Halflife mod on my other P.C.

  • I finally gave up and decided to use the physics behavior, and I'll make a thread for the project when it's in a playable state.

  • If you only want your crates to simply fall down when they're not on ground, the physics behavior might be a little overkill.

    Here is how I made your events work with some minor adjustments and most important of all an For each loop:

    http://dl.dropbox.com/u/2306601/crategrav.cap

  • Platform behavior should work.

  • If you only want your crates to simply fall down when they're not on ground, the physics behavior might be a little overkill.

    Here is how I made your events work with some minor adjustments and most important of all an For each loop:

    http://dl.dropbox.com/u/2306601/crategrav.cap

    I don't really get how the "For Each" event works but this is definately what I was trying to do. I'm still split between using the physics behavior or a custom movement. A custom movement would be less glitchy, but the Physics Behavior looks alot better. fV:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For Each is like a loop which loops through the objects created. If you want conditions to be checked against each crate, you add sub-events. If you place events with the for each, it will do those to each crate.

    For Each (Crate) : Y = Self.Y+1

    • If Crate.Value('health') =< 0 : Destroy crate

    This would make all crates move down by 1 pixel, and if one were out of health, destroy it. The health part is a sub-event.

  • Platform behavior should work.

    Works quite well actually.

    Just use a start of layout to set user input ignored.

    And set the attribute solid.

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