GameSalad

How to stop when colliding with a box?

I'm making an infinite platformer, where the player needs to stop when he collides with a box obstacle. The only thing that moves in the game is the ground under the player (the player.position.X is constrained). This means that I drop the box on the ground and the ground moves it toward the player like a conveyor belt. I am trying to make it so the box moves with the ground, but cannot be moved by the player AT ALL. The player can jump on top of the box or over the box (meaning he needs to be able to move on top of the box). This proves difficult when trying to use the collision behavior because the player gets stuck on top of the box and can only move when he jumps (move in the air). I have tried several approaches to this problem and none of them are accomplishing this the proper way. Any solutions? Is there a way to do this with physics? Like make the box so strong that the player cant move it no matter what, but can still jump on top of it and move on it...Any help/advice would be greatly appreciated. Thanks in advance!

Answers

  • tatiangtatiang Posts: 10,849Member, Sous Chef, PRO, Senior Sous-Chef
    edited August 7

    Disclaimer: platformers are not at all my strong suit

    Here's how I'd start out... (up arrow key repeatedly to jump)

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Triangularity+GamesTriangularity Games Posts: 119Member, PRO

    @tatiang said:
    Disclaimer: platformers are not at all my strong suit

    Here's how I'd start out... (up arrow key repeatedly to jump)

    Kinda, but not quite. In your example, the scene moves automatically. See if you can figure out with my movement...its very weird and peculiar I've played around with the physics, and I can't seem to find a workaround.

  • tatiangtatiang Posts: 10,849Member, Sous Chef, PRO, Senior Sous-Chef

    @Triangularity Games said:
    In your example, the scene moves automatically.

    Okay, I see in your project file how you've set this up. Makes sense. I don't have a fix though, sorry!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,881Member

    Use friction. Friction needs high numbers, both the ground and box need to have an amount set or friction will not work. Also make sure your player actor has zero friction. Also make sure bounce is set to zero.

  • Twayne2Twayne2 Posts: 17Member, PRO

    real simple, just make the box have tone of density, (say, 5k.)

  • Triangularity+GamesTriangularity Games Posts: 119Member, PRO

    @The_Gamesalad_Guru
    @Twayne2

    Did you see if this worked with the test file in this thread? I've tried playing with the physics in all sorts of ways and never found a solution...let me know if either of you can. Thanks!

  • Twayne2Twayne2 Posts: 17Member, PRO

    Um the file doesn't work for me... I extracted it but the gsproj doesn't have anything, as it is just blank.

  • Twayne2Twayne2 Posts: 17Member, PRO

    wait scratch that.

  • Twayne2Twayne2 Posts: 17Member, PRO
    edited 6:49PM

    Ok I need to know what you want the box to do when it collides with the player... does it push him back? Is there a zone behind the player that destroys him? If so then I believe I have a solution. :smile:

Sign In or Register to comment.