using game maker 8.0 or 8.1
Game Maker file with completed simulation
One Lab Report Word document (*.docx) containing:
the design elements asked for in lab
screen captures of your running application
one to two paragraphs answering the Student Lab Report questions (below)
Student Lab Report Questions
How are simulations and games different? How are they the same?
L A B S T E P S
STEP 1: Create Sprites
You will need two sprites for your simulation, one image of a prey such as a fish or rabbit, and one image of a predator such as a shark or wolf. Find a few images of each to choose from or draw your own.
Use a screen size of 800x600 with a 2D grid that has squares that are 20x20
Create two sprites using your images. Name one spr_prey and the other spr_predator
STEP 2: Create Objects
Create two objects – one for the prey and one for the predator.
STEP 3: Create a Room
Create a room according to your design.
STEP 4: Populating
Add about 10 of each predator and prey to the room.
STEP 5: Prey Object: Speed and Direction
For the prey object, add a Create event that sets the prey's speed to 4 and direction to random(360).
STEP 6: Prey Object: Intersect Boundary
For the prey object, add an Intersect Boundary event that wraps the screen in both x and y directions.
STEP 7: Prey Object: Mating and Birth
For the prey object, add a collision event for colliding with other prey that will simulate mating and the birth of a new prey. Add the following action: bounce against solid objects if a nearby and relative position is free of collisions, with a one in two chance create a new instance of obj_prey at the same nearby, relative position.
STEP 8: Prey Object: Collision Event
For the prey object, add a collision event for colliding with predators that will destroy this instance of the prey (this prey just got eaten).
STEP 9: Prey Object: Step Event
For the prey object, create a step event that will limit the total number of prey instances (limit the prey population) with actions: if the number of instances > 100, destroy this instance (this prey just died from overcrowding).
STEP 10: Predator Object: Speed, Direction, Hunger
For the predator object, add a Create event that will set the predator's speed to 3 and direction to random(360) and set a hunger variable with a random value from 0 to 90:use random(90).
STEP 11: Predator Object: Intersect Boundary
For the predator object, add an Intersect Boundary event that wraps the screen in both x and y directions.
STEP 12: Predator Object: Collision Event I
For the predator object, add a collision event for colliding with prey that will reset the hunger variable to 0.
STEP 13: Predator Object: Collision Event II
For the predator object, add a collision event for colliding with other predators that has the following statements:
reverse the vertical direction; reverse the horizontal direction
if the expression hunger < 100 & [url removed, login to view] < 100 (meaning if the two colliding objects are not starving)
if a nearby and relative position is free of collisions, create a new instance of obj_predator at the same nearby, relative position
STEP 14: Predator Object: Step Event
For the predator object, create a step event that will kill this predator by using the destroy instance action if either of the following conditions is true
if the predator is starving (hunger > 400)
if the number of instances of predators is larger than 50
Also, increment the hunger of the predator by 1 by setting the hunger variable to a new value of hunger + 1
STEP 15: Run and Test
Run the program to see if a stable population of predators and prey can be obtained. Each run may yield somewhat different results due to the randomness.