Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-28-2008, 09:34 PM
Member
 
Join Date: Jan 2008
Posts: 1
mscwd is on a distinguished road
Collision Detection (Game)
I am making my first game using the J2ME platform and have a question about collision detection. The game is a "super Mario" game which uses a TiledLayer to draw the "world".

Basically I need to figure out a way of detecting when the "Mario" sprite the user plays with lands on the ground, a hill or another item (represented by the TiledLayer).

Take a look at these two images to understand better what I am trying to explain:

Image 1:
http://img2.freeimagehosting.net/uploads/c17b5e6e92.jpg

Image 2:
http://img2.freeimagehosting.net/uploads/1c6b0c514a.jpg

Currently to determine whether Mario has landed on the ground or another item I use the following code:

if(MarioCanvas.marioSprite.collidesWith(MarioCanva s.gameLevel, false)) {
// ...Note: MarioCanvas.gameLevel is the TiledLayer
}


It works to a certain degree, however as you can see from Image 1, Mario can land on the lower "hill" walk off it and float as the sprite is colliding with the taller hill behind it.

What I ideally want is a method to determine if the sprite has landed on a particular vector/line (between two points) as illustrated in Image 2 with the yellow lines. This way would work much nicer than simply detecting if Mario has collided with a tile in the TiledLayer.

Is there a way to do this?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HashMap: Obtaining all values in a collision? markus-sukram New To Java 2 03-29-2008 11:25 PM
Two Problems Rotating and collision detection help jaferris Java Applets 2 01-08-2008 12:19 AM
Implementing "Game Over" in Minesweeper game based on Gridworld framework. JFlash New To Java 0 11-16-2007 12:02 AM
Listener collision on game cachi Java Applets 1 08-07-2007 08:48 AM
Deadlock detection tools documentation goldhouse Threads and Synchronization 0 07-18-2007 06:18 AM


All times are GMT +3. The time now is 01:56 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org