Creating treasure

9 views
Skip to first unread message

nram...@ellingtonps.net

unread,
Dec 8, 2014, 7:32:31 AM12/8/14
to starlo...@googlegroups.com
Is there a way to create treasures that have different starting points throughout the terrain, without having to establish a ton of separate treasure blocks with various settings? The terrain they are working with is maze-like, and therefore, they would like to set up treasure throughout the maze.
 
Thank you!

Daniel Wendel

unread,
Dec 8, 2014, 10:52:35 AM12/8/14
to starlo...@googlegroups.com
There are two usual ways to do this:

1) use some math and the agents' ID numbers to calculate starting positions. For example, set x to ID * 5. Then you can cut down on the number of individual setup blocks you need.

2) have treasures run a procedure that places them on the ground. Create a procedure, and inside it, use a repeat block with a big number of repeats. Inside the repeat, do "IF patch height != 0 then setx ((random 101)-51), sety ((random 101)-51) ELSE exit proc." That way, it will keep moving itself to a random location until it detects that it is on the ground. Once it is on the ground, it will just end the procedure and move on to the next treasure.

Hope this helps!

On Mon, Dec 8, 2014 at 7:32 AM, <nram...@ellingtonps.net> wrote:
Is there a way to create treasures that have different starting points throughout the terrain, without having to establish a ton of separate treasure blocks with various settings? The terrain they are working with is maze-like, and therefore, they would like to set up treasure throughout the maze.
 
Thank you!

--
You received this message because you are subscribed to the Google Groups "StarLogo TNG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to starlogo-tng...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nram...@ellingtonps.net

unread,
Dec 10, 2014, 6:57:51 AM12/10/14
to starlo...@googlegroups.com
Thank you!

nram...@ellingtonps.net

unread,
Dec 10, 2014, 8:03:27 AM12/10/14
to starlo...@googlegroups.com
Could you please explain this section further? "setx ((random 101)-51), sety ((random 101)-51) ELSE exit proc"
My student is having trouble finding these specific blocks with the way you have the parentheses set up.
 
Thanks!

On Monday, December 8, 2014 10:52:35 AM UTC-5, Daniel (StarLogo TNG Team) wrote:

Daniel Wendel

unread,
Dec 10, 2014, 1:42:39 PM12/10/14
to starlo...@googlegroups.com
Sure, it's an if-else block. Inside the 'if' part, there's a setx and sety. Both of them have the same blocks plugged in. I'll use angle brackets to try to make that part clearer:
<<random <101>> - <51>>

I hope this helps - it's just a minus block, a random block, and two number blocks. But the important part is that the random 101 is on one side of the minus, and the 51 is on the other side.

--Daniel

nram...@ellingtonps.net

unread,
Dec 11, 2014, 7:32:20 AM12/11/14
to starlo...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages