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

2011/12/5

NEED HELP!!!!! PLEASE

easymal easymal

2011/12/5

#
hello fairly new to programming i need a code that " if at world edge add a certain amount of objects that get incremented but stay a good amount away from each other so they will not overlap" please help!!
mjrb4 mjrb4

2011/12/5

#
What have you tried already?
davmac davmac

2011/12/5

#
Please read this.
easymal easymal

2011/12/5

#
if(atWorldEdge()) { addObjecct(new Object(x,y); addObjecct(new Object(x,y); addObjecct(new Object(x,y); setLocation(x,y); } this is a summary of what i have I'm very confused
davmac davmac

2011/12/5

#
Your question doesn't really make sense to me:
... add a certain amount of objects that get incremented ...
Objects don't "get incremented". What do you mean by that? Also, where do you want the objects to be added - what are they for, or what do they represent? And: we need to see more code than that. What are the x and y values you are using - where do they come from?
Andres Andres

2011/12/6

#
I believe he means he wants the actors to be added to the world at a fixed distance from eachother, but not overlapping. This could be done by hard coding different values where x and y are that are far enough apart that the objects don't overlap. Unless you're feeling fancy, in which case a for() loop would be a better idea.
easymal easymal

2011/12/6

#
thank you andres!! do you mind giving me an example
You need to login to post a reply.