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

2016/4/28

Using getOneObjectAtOffset() in Greeps scenario

edik_192 edik_192

2016/4/28

#
Hi all, Can I use
TomatoPile tomatoes = (TomatoPile) getOneIntersectingObject(TomatoPile.class);
instade
TomatoPile tomatoes = (TomatoPile)getOneObjectAtOffset(0, 0, TomatoPile.class); 
in Greeps scenario? Is it not against the rules?
edik_192 edik_192

2016/4/28

#
Sorry, vice versa :-)
TomatoPile tomatoes = (TomatoPile)getOneObjectAtOffset(0, 0, TomatoPile.class); 
instead
TomatoPile tomatoes = (TomatoPile) getOneIntersectingObject(TomatoPile.class)
danpost danpost

2016/4/28

#
Rule 5: No long vision. You are allowed to look at the world only at the immediate location of the Greep. Greeps are almost blind, and cannot look any further.
I would presume that when using 'getOneObjectAtOffset', the x and y offset values cannot be any value other than zero. That is: getOneObjectAtOffset(0, 0, TomatoPile.class); would be okay to use. Any other values I would believe to be against the rules.
edik_192 edik_192

2016/4/29

#
Thank you I need just the values (0, 0)
You need to login to post a reply.