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

2016/2/18

New to coding

kinder1 kinder1

2016/2/18

#
Hi! i was wondering how to write a code that will tell me if my animal is over an inanimate object
David-FireTech David-FireTech

2016/2/18

#
You could try using getOneIntersectingObject(inamimate.class) assuming your inamimate object was an actor named inanimate. e.g. this code would go on your animal
Actor touchingObject = getOneIntersectingObject(inamimate.class);

if(touchingObject != null)
{
// your code for when animal over object
}
You need to login to post a reply.