1. Check out our companion app, Forums for Android! Download from Google Play

Simple Collision Detection

Discussion in 'Application Development' started by Kadafi, Feb 24, 2012.

  1. Kadafi

    Kadafi Member
    Thread Starter
    15

    Feb 24, 2012
    11
    0
    15
    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
     

    Advertisement

  2. powerpoint45

    powerpoint45 Well-Known Member
    16

    Dec 27, 2011
    58
    5
    16
    You will need to make your own if statements,such as
    if (left>otherballleft){
    Die
    }

    Just tweek it till u got it
     
    Kadafi likes this.
  3. aciampal

    aciampal Member
    36

    Feb 4, 2012
    22
    3
    36
    Italy
    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
     
    Kadafi likes this.

Share This Page

Loading...