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

2015/1/10

Uses of....

DemonsWhiteSoul DemonsWhiteSoul

2015/1/10

#
Can someone please tell me what does : getOneObjectAtOffset Do? & What can it be used for? Please can someone help. many thanks.
danpost danpost

2015/1/10

#
The 'getOneObjectAtOffset' is probably best suited for worlds that are divided into cells (larger than one pixel). For example for a checkerboard or for something like the basic Wombat scenario. The method will look at the center of the cell location at (getX()+dx, getY()+dy) where dx and dy are the offsets in the horizontal and vertical directions in cells. Any actor whose image (any part of it) overlaps that location is considered an object at that offset.
DemonsWhiteSoul DemonsWhiteSoul

2015/1/10

#
Ohhh, so for example, it could be used to make solid objects like a wall?
danpost danpost

2015/1/10

#
DemonsWhiteSoul wrote...
Ohhh, so for example, it could be used to make solid objects like a wall?
No -- it cannot be used to make any objects. Maybe you meant to say it could be used to check for objects that need to be avoided (which would then make those objects obstacles like walls. Well, then, I guess so. It could be used to determine if a specific object is at the offset. Like in chess, a pawn can only move directly forward if the square in front of it is empty. You could use it to check that particular square for any piece being located there, for one instance of its use.
You need to login to post a reply.