Slick Forums

Discuss the Slick 2D Library
It is currently Sat Dec 16, 2017 2:50 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Colision detection :(
PostPosted: Mon Dec 04, 2017 8:31 pm 
Offline

Joined: Fri Dec 01, 2017 12:36 pm
Posts: 1
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 :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group