Access StarLogo Nova at www.slnova.org
Copyright © 2023 MIT Scheller Teacher Education Program
with
CLOCK
Keep track of time to impose limits on your player, change aspects of the game over time, and more!
The clock advances by 1 tick every StarLogo loop.
Combining this with the “Remainder” block can cyclic behaviors.
You can create a world trait to simulate a daily cycle. Now you can base the behavior of any agent on what time it is!
Recall that the remainder of 0/5 is 0, remainder of 1/5 is 1, remainder of 2/5 is 2 and so
on. However, the remainder of 5/5 is 0, remainder of 6/5 is 1, and so on.
In the code to the right, the agent will move forward by 1 unit and turn left by 15 degrees only when the clock/5 has a remainder of 0.
LOGIC
Logic blocks can be both very confusing and very helpful in StarLogo Nova and coding in general.
The if block takes a
condition and runs the code inside only if that condition is true. The if/else block has code that runs when the condition is not true.
The while block is similar, but the code inside keeps running in a loop as long as the condition is still true.
All of these blocks can be used to create conditions. You can even combine these three to add more!
Special symbols:
!= not equal
>= greater than or equal to
<= less than or equal to
Conditions don’t have to use numbers! You can check for colors, shapes, terrain, custom traits, etc!
COORDINATES
Anytime you want to move/draw in StarLogo Nova, keep Spaceland’s coordinate system in mind.
Spaceland has 3 axes.
The X axis is horizontal from -50 to 50, and the Y axis is vertical from -50 to 50. The Z axis starts at 0 on Spaceland and comes out of the screen, or is “up” when an agent takes the camera.
50
50
-50
-50
Y
X
Z
Y
X
END OF GAME
Set your game to run for a certain amount of time, until a certain score is met, or if the player dies.
Use a toggle button to start
your game. (See CUSTOM BUTTONS for more).
When the Player collides with a Hazard agent, the collision toggles the PLAY GAME widget off for everyone, which stops the game.
You could also stop the game if the clock reaches a certain value (see CLOCK), if you get a certain score, or if some other condition is met.
You can add game over messages (see TEXT MESSAGE) or extra lives.