Jumping Dino Game – Sam H, Jud, Matt

Jumping Dino Game

Project description: Our project is designed to teach students very basic fundamentals of coding by changing settings of a simple game. Some of the settings they will change include gravity, jump power, and running velocity, which will hopefully contribute to an understanding of physical principles. These settings must be changed in order for the student to win the game, as it is impossible with the default settings.

Learning goals: The child will learn the very basic aspects of programming such as variable assignment, and we also hope that seeing how these changes can directly impact the game state will inspire students to learn more in the future. Furthermore, since the game simulates physics concepts such as gravity and velocity, we hope that it will also give them a feel for how each kinematic principle interacts with the other in a 2D-space.

Materials required: A computer with python downloaded (it doesn’t really matter which version, but the newer version will probably work the best).

Description of the activity for the adult: In order to teach this activity, a good understanding of basic kinematic concepts like gravity and projectile motion would be useful. In addition to projectile motion, a good understanding of power would also be useful. While this activity does have some coding in it, very minimal knowledge is required in order to run the game. If an error does occur in the code while running, try re-running the code or re-copying and inserting the code into the python software. This activity is best completed with one child, however, it can be done with multiple children suggesting different values for gravity, speed, and power. 

Description of the activity for the child: In order to start this activity, download the zip file at the bottom of the page under the section Code. Once completed, first double click the zipped file to unzip it and then open the file in python. Follow the instructions at the top of the file and refer back to this page before and after each activity for a brief summary of the key concepts for that activity.

 

Obstacle Layouts:

  1. Activity #1 (Speed):

    • Watch this video on Speed v.s. Velocity and pay attention to what role direction plays in the determination of velocity.
    • In this game, the directions that velocity can have are determined by an xy-coordinate system such as the one below:
    • In this coordinate system, velocity will have a vertical and a horizontal component. These components control the speed at which the dino moves in a specific direction. For example, the horizontal velocity controls the speed at which the dino moves in the horizontal direction.
    • The quantity that you will be changing in this activity is the dino’s horizontal velocity.
    • Constant Variables:
      • Gravity → 7
      • Jump Power → 70
    • For this activity, only change the value for the speed variable
    • Notice how this parameter affects the motion of the dino:
      • How does it make the dino move differently?
      • Does it make the dino jump farther/not as far?
      • What effect does it have on the airtime of the dino?
    • Post-Activity Reflection:
      • Notice how the height of the dino’s flight path isn’t affected by the horizontal velocity. This is because you are only changing the horizontal component of the dino’s velocity and can thus only change the distance in the horizontal direction that the dino covers.
      • By increasing the speed of the dino, you increased the amount of distance that the dino was able to travel while in the air. This corresponded to a farther jump.

 

 

  1. Activity #2 (Power):

    • In this next activity, you will explore the effects of changing the dino’s vertical acceleration and its impact on its vertical velocity.
    • First we need to understand acceleration and and the role it has in the trajectory of the dino. Acceleration is the quantity that measures the rate at which an object’s speed or velocity changes over time given by the equation a=(change in v)/t
      • (where v is velocity and t is the time over which this change takes place). 
    • If we apply this to the dino, as it jumps up and down, its horizontal velocity remains constant over time and thus has change. Observing its speed in the y-direction gives us a different result. The vertical velocity starts out at 0 and then increases when we tell the dino to jump (i.e. a change in vertical velocity). Since there is a change in vertical velocity, this means that there is acceleration in the vertical direction.
    • Constant Variables
      • Gravity →  6 
      • Speed →  15
    • For this activity, only change the value for jump power
    • Ask yourself the same questions as before:
      • How does this parameter affect the motion of the dino?
      • Does it make the dino travel higher or lower?
      • How does this variable affect the dino’s y-acceleration and y-velocity?
    • Post-Activity Reflection:
      • Reflect on how increasing the jump power affected the y-acceleration of the dino. You should have observed that increasing the dino’s jump power increased its initial change in vertical velocity upwards. This increasing amount of change results in a greater initial vertical acceleration upwards. One effect of this larger acceleration is an increased maximum jump height. By increasing the change in velocity, the dino was able to achieve a higher maximum velocity and thus reach a higher jump height. Another effect of this larger vertical acceleration upwards was that the dino was able to stay in the air for longer. Since the dino was able to achieve a higher maximum vertical height with a larger jump power, this means that the dino was able to stay in the air for longer.
  1. Activity #3 (Gravity):

    • Watch this video on gravity and how it affects movement.
    • Constant Variables
      • Jump Power → 125
      • Speed → 16
    • For this activity, only change the gravity value
    • Observe how the motion of the dino changes with large and small numbers for gravity
      • Does it come down faster/slower?
      • Does it affect the maximum height the dino reaches?
      • How does it contribute to the dino’s overall time in the air?
    • Post-activity Reflection:
      • Reflect on how increasing the gravity value in the code affected the vertical acceleration and vertical velocity of the dino. You should have noticed that as the gravity value increased, the downward vertical acceleration of the dino increased. This is because gravity causes objects to accelerate towards the earth (i.e. downwards). Thus by increasing the gravity value, you decreased the effect of the initial vertical acceleration. By decreasing the effect of the initial  vertical acceleration upwards, the properties of the dino’s jump path changed by increasing the jump power were changed in the opposite way. More specifically, this caused a decrease in air time and maximum jump height. These effects on the dino’s maximum jump height and air time also caused a reduction in the horizontal distance it was able to travel.
  1. Activity #4 (Final Activity):

    • Initial Values:
      • Gravity → 1
      • Jump Power → 10
      • Speed → 5
    • Adjust the values of these three variables as you see fit trying to make it to the finish line of the obstacle course.

 

Code:

Jumping Dino Game.py