Results 1 to 3 of 3
  1. #1
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Collision detection between player and platform

    I have a simple platform game that allows the player to jump onto platforms and climb a tower. It is essentially vertical scrolling. I have run into a wall trying to figure out how i can detect a collision between the player and a block.

    My basic problem is trying to figure out how i can have many blocks drawn to the screen and detect if the player is touching one or more individual blocks.
    Does each block need an id and then i check each block for collisions? (that would just be a waste of resources and time!)

    Any ideas?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Collision detection between player and platform

    I'm assuming that your gui or "view" has an underlying non-gui model that it's based on, and if so, all collisions should be analyzed there, not in the GUI section of the code which simply displays what the model tells it to display.

  3. #3
    jammas615 is offline Senior Member
    Join Date
    Jul 2011
    Location
    Melbourne, Victoria, Australia
    Posts
    155
    Rep Power
    4

    Default Re: Collision detection between player and platform

    Okay. I have a block class that contains the data for each block that is drawn. When a map or platform is draw a random number is generated, this number is fed into a loop that draws a new Block() each time. Is there a better way to do that? Especially when it comes to detecting collisions.

Similar Threads

  1. Collision Detection
    By Äppelpaj in forum Java 2D
    Replies: 1
    Last Post: 10-13-2011, 03:29 PM
  2. Collision Detection
    By sunde887 in forum Java 2D
    Replies: 2
    Last Post: 10-07-2011, 11:40 PM
  3. Collision Detection?
    By Alerhau in forum New To Java
    Replies: 39
    Last Post: 09-07-2011, 04:55 PM
  4. Really Need help with some collision detection
    By Harwad in forum New To Java
    Replies: 1
    Last Post: 01-23-2011, 12:38 AM
  5. Collision Detection
    By dotabyss in forum Java Gaming
    Replies: 0
    Last Post: 03-14-2010, 06:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •