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

2012/2/15

safe spot

Tomc84 Tomc84

2012/2/15

#
Is there a way to make a safe spot so that an object will not get eaten there?
Morran Morran

2012/2/15

#
It's possible, yes. I don't really know the context, so I can't say just how to do it, though. You could probably put in some code in the "eaters". When the "eaters" eat, they check to make sure that they are not in a safe zone. You could have the safe zone be its own type of Actor. Choose an image to bound the safe zone. If you do, than the "eaters" could just check
 if(!getOneIntersectingObject(SafeZone.class)) {
  //code to eat things.
}
Since the image is always square shaped, having a round safe zone would take some tinkering.
You need to login to post a reply.