Slick Forums
http://slick.ninjacave.com/forum/

Colision detection :(
http://slick.ninjacave.com/forum/viewtopic.php?f=3&t=8445
Page 1 of 1

Author:  Fliens [ Mon Dec 04, 2017 8:31 pm ]
Post subject:  Colision detection :(

hey i'm trying to program a coliosion detection and i basically want a boolean switch to true if the shape(rectangle) "hitBoxUp" colides with a shape from the arraylist "shapes" but when hitBoxUp intersects a shape from "shapes" it doesn't change. I tried it with

if(hitBoxUp.intersects(shapes)){
upColides = true;
}

and that actually worked but when i added an else statement

if(hitBoxUp.intersects(shapes)){
upColides = true;
}else{
upColides = false;
}

it wont change anymore.
Right now i tried it this way:

for (Shape shapes : Obstacles.ObstaclesSetup.hindernisse) {

upColides = hitBoxUp.intersects(shapes);

downColides = hitBoxDown.intersects(shapes);

leftColides = hitBoxLeft.intersects(shapes);

rightColides = hitBoxRight.intersects(shapes);
}

But that wont work either :(

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/