email me at borlaj@portlandschools.org

Loading
notes previous (10/<10) submit the dump links  
 

Bug World

 

Create a world that is a bug on the screen. Everytime space is pressed, the bug will move randomly either forward, turn left or turn right. It should move most of the time (70%) forward; 15% of the time it will turn left, 15% turn right. If it reaches the edge of the screen, have the object move to the center fo the screen. In the bottom of the scene, have a text the will keep track of how many times the object moves to the center of the screen.

 

Hint:

  1. You might make a random variable between 0 and 1 and then a bunch of if statements for direction.
  2. To keep track of the number, create a variable for the bug.
  3. To print the text, you will need to change the number to a string. Use what as a string (under world) to convert. See here in ALICE