Schools Computing Games Programming Lesson 5 Gravity and its effects Do Now Log into SCRATCH and load your file from last lesson httpsscratchmitedu Learning Objectives Today we ID: 601774
Download Presentation The PPT/PDF document "University Learning in" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
University Learning in
Schools
Computing
Games Programming
Lesson
5Slide2
Gravity and its effects
Do Now
Log into SCRATCH and load your file from last lesson
https://scratch.mit.edu
/Slide3
Learning Objectives
Today we
will …
Identify and explain what gravity is and how it affects everyday life.
Apply knowledge of variables to create gravity in Flappy Bats game.
Create extra difficulty in the game by adding difficulty buttons at start of the game. (Changes in gravity)
Today
we are…
Understanding what gravity is and how it can be used in a game.Today’s key learning skill is…Problem solving, using algorithms to create solutions.
Key Words: Gravity, Variable, Difficulty.Slide4
What is gravity?
Can you think of what gravity is?
Talk to the person next to you about what it might be.
You may want to think about:A definition for it.How we know it exists.
How could it be shown in a game.
Key Words: Gravity, Variable, Difficulty.
2
minsSlide5
Key Word
Gravity
A
force that attracts objects towards each other.The force of gravity is not very noticeable unless one of the objects – such as the Earth or the Sun – has a huge mass.
However gravity can be seen in everyday life.
Key Words: Gravity, Variable, Difficulty.
How could we show gravity right now?Slide6
Gravity in Flappy Bats
Our bat needs to be able to demonstrate some sort of gravity.
How does your sprite fall at the moment in the game at the moment?
Key Words: Gravity, Variable, Difficulty.
Think about those skydivers.
We need a way to adjust the speed of falling, the longer the bat is falling.
What could we use to store this data?
Think about last lesson.Slide7
Creating a variable called
G
ravity.
Demo
Time – Make sure you pay attention.
Key Words: Gravity, Variable, Difficulty.Slide8
Adapting your code
Key Words: Gravity, Variable, Difficulty.
New script here!
What does it do?
The code here will need to be edited.
How can we use our gravity variable to change the falling speed.
7
mins
Before
AfterSlide9
Lets create the scripts.
Demo
Time
Key Words: Gravity, Variable, Difficulty.Slide10
As you saw, the sprite falls faster the longer that it is falling.
This provides more realistic gameplay and represents what would happen in real life.
Think about what happens to your gravity variable too.
Gravity in action
Key Words: Gravity, Variable, Difficulty.Slide11
Task - Adapting your code
Key Words: Gravity, Variable, Difficulty.
Edit your code to add the gravity feature.
Keep testing your game to see if it works or if it gives you any problems.
Finished?
See if you can add a difficulty button that sets different levels of gravity?
15
mins
Before
AfterSlide12
Checklist
Background and character completion
Game over when you hit the edge
Game over when you hit an obstacle Character costumes createdObstacle movementMultiple costumes createdObstacles moving and resetting
Variables createdSetting the score to 0Adding to the score each time you pass an obstacle
Gravity added ( Increasing difficulty – Bonus)
Key Words: Gravity, Variable, Difficulty.Slide13
Saving
Time to save your project.
Make sure you save your work in your area.
Key Words: Gravity, Variable, Difficulty.Slide14
Have a look at the code below that you used in the your program earlier.
PAIR
– discuss in your pair how you would describe this code. Be ready to feedback to the class.
Plenary – Annotating
Scratch Scripts
Key Words: Gravity, Variable, Difficulty.
5
minsSlide15
Contact Details
Cory
Belony
CBelony@parliamenthill.camden.sch.uk
Daniel
Portelli d.portelli@cranfield.ac.uk