Variable collision detection

mikewaskiewiczmikewaskiewicz Member Posts: 1
edited December 2011 in Tech Support
I am trying to build something akin to Doodle Jump. The issue I'm bumping into is with collision detection. When a player jumps "through" a platform, no collision is needed. However, when the player "lands" on a platform the player needs to bounce. I could use location of player to turn collision on/off, but there are so many staggered platforms that this isn't practical. Does anyone know an easy way to do this?

Comments

  • CloudsClouds Member Posts: 1,599
    Rather than place the logic on every platform - just place it once on the actor.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Only collide if the players y position is higher that the platforms
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    edited December 2011
    Also open up GameSalad click new and search for Doodle Jump theres some free demos in there I think.
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    If it helps I thnk DBA offers a doodle jump template or offered a long time ago.... It might help to shoot darren an email or PM so head on over to www.deepblueapps.com
  • CloudsClouds Member Posts: 1,599
    edited December 2011
    ...
  • mikewaskiewiczmikewaskiewicz Member Posts: 1
    I solved this only moments after the original posting. For anyone that wants the solution...here it is. All of the logic is applied to the platform actor. You need to constrain the Player self.Position.Y to a variable. Then, if that constrained variable is greater than the self.Position.Y+(height of player/2) of the platform AND the Motion.Linear Velocity.Y of the Player is negative (<=0), then turn on the collide. The key is to make sure the velocity of the player is negative. You want want to make sure the player is in freefall for the collide. Anyways, it works and it's pretty efficient.
Sign In or Register to comment.