Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

test: Reply
 
LinkBack Thread Tools
Old February 24th, 2012, 05:08 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Feb 2012
Posts: 11
 
Device(s):
Carrier: Not Provided

Thanks: 3
Thanked 0 Times in 0 Posts
Default Simple Collision Detection

Hi, i am making a game where I have 2 bitmaps as objects, i want to check if object 1 and object 2 collide

e.g.

obj1 (moves around on screen)




obj2 (at bottom always)

when obj1 touch the top of obj2, i want to move obj1 back up.

could anyway please help me with this. I have looked online and found many examples but they are too complicated, and I am just a new developer, and just want a simple collision detection and nothing too fancy.

thanks

Advertisements
Kadafi is offline  
Reply With Quote
sponsored links
Old February 24th, 2012, 11:56 PM   #2 (permalink)
Junior Member
 
powerpoint45's Avatar
 
Join Date: Dec 2011
Posts: 58
 
Device(s):
Carrier: Not Provided

Thanks: 23
Thanked 5 Times in 4 Posts
Default

You will need to make your own if statements,such as
if (left>otherballleft){
Die
}

Just tweek it till u got it
powerpoint45 is online now  
Last edited by powerpoint45; February 25th, 2012 at 12:35 AM.
Reply With Quote
The Following User Says Thank You to powerpoint45 For This Useful Post:
Kadafi (February 26th, 2012)
Old February 25th, 2012, 02:31 AM   #3 (permalink)
Junior Member
 
Join Date: Feb 2012
Location: Italy
Posts: 22
 
Device(s): Acer Liquid Metal
Carrier: Not Provided

Thanks: 4
Thanked 3 Times in 3 Posts
Default

For a simple collision check you can use the "bounding box collision algorithm".

You can find a lot of samples and code on the net to explain this.
A simple procedure (and explanation) can be found, for example, at :

Collision Detection
aciampal is offline  
Reply With Quote
The Following User Says Thank You to aciampal For This Useful Post:
Kadafi (February 26th, 2012)
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

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

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



All times are GMT -5. The time now is 03:24 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.