This site requires JavaScript, please enable it in your browser!
Greenfoot back
xavi002
xavi002 wrote ...

2017/3/1

Collision/Intersection problem

xavi002 xavi002

2017/3/1

#
The intersection and collision tutorials seem pretty straightforward to me, but I can't find anything on google that has the same problem as me! I basically have a basket catcher game where i catch stuff from the sky. As soon as the random object is generated and appears in the sky, the getOneIntersectingObject(basket.class) != null when it should be, at least until it falls down and i actually collide with it. I check this via system print. I'm pretty much done with everything else but this has been driving me crazy and I'm not sure what's the problem! FWIW I scaled the images but afaik the image and actual object boundaries are supposed to be equal (and I'm not imagining some invisible box around it) D:
danpost danpost

2017/3/1

#
Try scaling the images using an image editor -- not with code in the project. (just a thought). Also, if you do have excess transparencies around your images, you can use my Image Transparency Adder/Trimmer scenario to remove the excess. When running the scenario, just load and save the image file -- the excess is automatically removed. Double check the image of the basket as well as the objects that fall.
xavi002 xavi002

2017/3/2

#
Okay, quite embarrassing, but there is an invisible box i didn't spot. i trimmed them all in a photo editor now :P everything works as intended, lol! frustrated me for hours...
You need to login to post a reply.