Scratch Lab 10

Name: Shreya Raj

Period: 7

Assignment: Lab #10

Lab Overview Game

This week’s lab was broken into two parts and involved clones. The first part was used to make graphs on excel which display the information from a simulation on a scratch game. This simulation was a predator - prey kind of thing involving rabbits and foxes. I had to make 3 different graphs involving how many rabbits and foxes were present during the simulation. The other part of the lab was to re-create a game. I chose to re-create the gremilin game. So a cloud keeps moving back and forth and shoots out watermelons. Then when a flying hippo gets hit by the watermelon then the sprite gets smaller. But if the watermelon gets does not get hit by the watermelon more than 10 times then it is game over. Click HERE to get to the lab instructions.

Questions Fox and Rabbit Simulation

  1. What data is attached to each clone? That is, what is changed on each clone that allows for the rabbits and foxes to appear/disappear?
      The code started off with initial foxes:12, inital rabbits:37, fox death rate:10, rabbit reproduction rate:40. Because it has the reproduction variable it is able to produce rabbits. Since the foxes "eat" the rabbits, the rabbits disappear. Also since there is a death rate, foxes are able to disappear.
  2. Are the simulation results the same each time? Why or why not?
      No because the code makes it random which number it picks for the death rate; so the data can change even if the starting number of rabbits and foxes are the same each simulation.
  3. My Solution Gremlin Game

    This game was awesome to re-create. To re-create it, I used 4 different sprites. So for the gremlin I used a hippo1 sprite instead. The hippo1 was programmed so that when the flag is clicked, the size should be set to 100%, the hits and misses variable should be set to 0, and I also added a forever loop. In this forever loop, I set the y to -130 and set the x to the mouse - so that the hippo1 would be controlled with the mouse to run along the x-axis. Within the forever loop I also added that if the hippo1 is touching the watermelon (I used watermelons in replca of water drops in my game) the the size should change by -10 and get smaller. In my other sprite which is a cloud that drops watermelons, I programmed the sprite so that whenever the green flag is clicked that it would start at a specific x y coordinate and then forever change x so that it would keep moving back and forth the x-axis at the top of the screen. I programmed the cloud sprite so that also when the flag is clicked to have a forever loop and create a clone of the watermelon every one second. My other sprite being a watermelon, I programmed this sprite to hide when the flag is clicked. But when it gets the message to start as a clone from the cloud sprite, then it should show, go to the cloud, and then I had a forever loop. Within this forever loop fo the watermelon I had it so that it would move downward so change y by -5 and I had an if then statement say if the watermelon is touching the edge then to add 1 to the misses variable and then delete the clone. Then I used another if then statement to say that if the misses variable = 10 then the game is over and to switch the background to indicate the game is over. Last in this forever loop for the watermelon, I used another if then statement. I said if the watermelon is touching the hippo1 then to change the hits by 1 and create a clone of hippo 2 and then delete the watermelon clone. Lastly for my last sprite which was hippo2, I had it receive a when I start as a clone message. So when it recieves that, it should go to hippo1, change y by 20, show (because it is hidden when the flag is clicked), and then in a repeat 20 it should change x by 5 and why by 5 to make the clone move diagonally. Then of course hide. So that seemed to work and re-create the original game really well.

    My Project Link

    Click HERE to return to homepage.