Programming players

5 views
Skip to first unread message

nram...@ellingtonps.net

unread,
Dec 8, 2014, 8:17:05 AM12/8/14
to starlo...@googlegroups.com
How can you program a player to walk a certain amount of steps and then "die?"
 
We are having a difficult time trying to make this happen, as simple as it sounds. Thanks!

Daniel Wendel

unread,
Dec 8, 2014, 11:05:04 AM12/8/14
to starlo...@googlegroups.com
I'm guessing that the difficulty is because you want this to happen in a collision, and yield isn't allowed in collisions. What you need to do is something like:

In the collision:
- set the color of the agent to something, maybe red or blue, to indicate that it is about to die (if the agent's shape has a "skin" you won't see this difference, so it's just an internal marker)

In the main forever code for that breed:
- if color = red (or whatever you use) then
    - repeat 10 (or some number)
         - forward 1
         - yield
    - (you might want add another repeat/yield loop here with something other than movement, like a say block or something)
    - die

Does this help?


On Mon, Dec 8, 2014 at 8:17 AM, <nram...@ellingtonps.net> wrote:
How can you program a player to walk a certain amount of steps and then "die?"
 
We are having a difficult time trying to make this happen, as simple as it sounds. Thanks!

--
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, 8:06:09 AM12/10/14
to starlo...@googlegroups.com
Perfect. Thanks!
Reply all
Reply to author
Forward
0 new messages