Platform Game Equations of Motion (.doc)

advertisement
PedGames Project Curriculum Document
Game Math: Equations of Motion
Math Concepts: Algebra and Functions (AF), Mathematical Reasoning (MR),
Number Sense(NS),
Game Concepts: Player movement, Jumping and Gravity
Definitions:
Classic Equations of Motion are given as below:
1) v = u + at
2) s = ut +1/2at2
3) v2 = u2 + 2as
where the symbols are as follows:
v = final velocity
u = initial velocity
s = displacement (distance between initial and final position)
a = acceleration
t = time taken to move from initial to final state.
In Game Maker,
Velocity (u & v) means how many pixels an object moves per step (pixels / step)
Displacement(s) is the no.of pixels.
Acceleration (a) = pixels / step2
Time (t) = no. Of steps
PedGames Project Curriculum Document
Example: Find the jump time of the ball.
1) Consider the above world where gravity = 0.5 pixels / step2 and when UP
arrow key is pressed, the ball is thrown upwards with an initial velocity of 12
pixels / step. Calculate the time required in seconds for the ball to achieve the
maximum height before falling down on the ground.
Solution:
Initial velocity u = 12 pixels / step
Final velocity v = 0 (At maximum height, the ball stops, hence v = 0)
Acceleration (gravity) a = -0.5 pixels / step2 (gravity acts downwards whereas ball
is thrown upwards hence negative acceleration)
Using first equation (v = u + at),
We have,
0 = 12 + (-0.5) x t.
0.5t = 12
t= 24 steps.
PedGames Project Curriculum Document
Time (sec) = 24 steps / 30 steps per second = 0.8sec
Answer: Time required = 0.8 sec for the ball to achieve max height before
falling down.
2) What will be the total time required for the ball to touch the ground when
thrown up with initial velocity = 12 pixels / step and gravity = 0.5 pixels / step 2 –
Solution:
Total time required for the ball to touch ground = 2 * time required to achieve max
height
From the above solution
Total time (t) = 2 * 0.8 = 1.6 secs.
Answer: Total time required for the ball to touch ground = 1.6 secs.
Try Yourself:
1) Consider the gravity = 0.5 pixels / step2 the ball is thrown upwards with an
initial velocity of 15 pixels / step. Calculate the time required in seconds for the
ball to achieve the maximum height before falling down on the ground.
2) What will be the total time required for the ball to touch the ground when
thrown up with initial velocity = 15 pixels / step and gravity = 0.5 pixels / step 2?
PedGames Project Curriculum Document
Example: Find the initial velocity of the ball.
Given gravity = 0.5 pixels / step2, time to attain maximum height for the ball = 1
sec, calculate the initial velocity with which the ball was thrown?
Solution:
Given: gravity a = -0.5 pixels / step2,
v = 0 pixels / step. (At maximum height, the ball stops, hence final velocity
= 0)
t = 1sec.
To find: u =?
First calculate time in terms of steps:
Time (steps) = 1 sec x 30 steps / sec = 30 steps.
Using first equation (v = u + at),
0 = u + -0.5 x 30
u = 15 pixels / step.
Answer: The initial velocity u = 15 pixels / step with which the ball was
thrown
Try Yourself:
Calculate the velocity at which the ball is thrown up when it attains a maximum
height at 2 sec and gravity = 0.4 pixels / step2.
PedGames Project Curriculum Document
Example: Find the distance covered by the ball.
Calculate the distance that the ball travels when it reaches the maximum height
when it is thrown with a velocity of 6 pixels / step and gravity of the world is set to
0.2 pixels / step2
Soln:
Given:
Initial velocity u = 6 pixels / step
Final velocity v = 0 pixels / step (At max height , the ball stops hence v = 0).
Acceleration a = -0.2 pixels / step2
To find: s = ?
Using the third equation of motion (v2 = u2 + 2as), we have
0 = 62 + 2 x -0.2 x s
-36 = -0.4 x s
s = 36 / 0.4 = 360 / 4 = 90 pixels.
Ans 4: Distance covered by the ball = 90 pixels
Try Yourself:
Calculate the total distance covered by the ball when it is thrown up and back to
the ground with a velocity of 10 pixels / step and gravity set to 0.2 pixels / step 2.
PedGames Project Curriculum Document
Assignment Problem:
Example: As shown in the above figure, there is a brick wall which is made up of
8 bricks, each 32 pixels wide and 32 pixels high. The bricks are placed on top of
one another to make the wall.
So at what velocity should the ball be thrown up so that it can jump the wall given
acceleration due to gravity is 0.5 pixels / step2.
Given:
Gravity a =0.5 pixels / step2.
Final Velocity at max height v = 0 pixels / step.
Distance s is given in terms of height of the wall.
For the ball to jump across the wall, the ball should travel the no. of pixels as the
height of the wall.
Wall Height = 8 x 32 = 256 pixels.
Hence s = 256 pixels.
PedGames Project Curriculum Document
Using third equation of motion (v2 = u2 + 2as).
0 = u2 + 2 x -0.5 x 256
u2 = 256
u = 16 pixels / step.
Answer: The ball should be thrown at least 16 pixels / step if it needs to
jump the wall of the given height.
Question:
Given that the maximum speed with which the ball can be thrown is 12 pixels /
step and gravity set to 0.5 pixels / step2, what should be the minimum height wall
that is needed so that the ball cannot jump. Also calculate the minimum no. of
bricks required to make such wall given that dimensions of each brick is 36 pixels
wide and 36 pixels high.
PedGames Project Curriculum Document
Exercise: Based on CAHSEE Questions on Algebra.
1) Solve for x.
5(2x – 3) – 6x < 9
2) What is the y- intercept of the line 2x – 3y = 12
3) What are the coordinates of the x-intercept of the line 3x + 4y = 12?
4) Mr. Jacobs can correct 150 quizzes in 50 minutes. His student aide can correct
150 quizzes in 75 minutes. Working together, how many minutes will it take them
to correct 150 quizzes?
5) Ricardo runs 10 miles each Saturday. If he doubles his usual speed, he can run
10 miles in one hour less than his usual time. What is his usual speed?
Answers:
Q1) x < 6
Q2) (0,-4)
Q3) (4,0)
Q4) 30 mins Q5) 5 miles / hour
PedGames Project Curriculum Document
Download