Lesson3 Teachers Guide
User Manual:
Open the PDF directly: View PDF .
Page Count: 3
Lesson 3 - Events - Teacher’s Guide
http://www.stencyl.com/teach/act3/
Objective
Expose students to fundamental programming concepts including Events, Variables and
Coordinate Systems (for drawing graphics).
Outcome
Students will apply the concepts they have learned by adding the following functionality to
an existing game:
●Adding collectible items.
●Drawing a score to the screen.
Lesson Plan (1 - 2 hours)
Discussion
20 minutes
Cover the topics under Discussion Notes (Page 2)
Present the topics. Pose questions at appropriate points and encourage
students to participate in the discussion.
Activity
40 minutes
Extend an existing game
Students will apply what they’ve just learned to add functionality to an
existing game.
Activity
60 minutes
Work on extra activities
Students will work on a more challenging set of activities in order to
demonstrate mastery of the concepts they’ve learned.
Note: Extra activities are optional but recommended.
StencylEducator’sKitLesson31
Discussion Notes
Topic 1: Events
Events are things that “happen” in a game. Events are important because they make the
game act differently depending on what is happening.
For example, if the player presses the jump button, we expect the Hero to jump. For this
happen, the game fires a key-press event, which triggers the jump behavior for the Hero.
Discussion Idea: What are examples of events? Have students come up with these on their own.
●External Events
○Keyboard
○Mouse Clicks
○Touch
○Camera
○Network / Internet
●Internal Events
○Collisions
○Actors reaching some part of a stage
Topic 2: Variables
Variables let us remember things for the future. In Stencyl, we call them
attributes
.
For example, in a baseball game, each team’s score is tracked over the course of the
game. Variables are much like keeping score (but they can hold more than just numbers!).
Discussion Idea: Have students come up with reasons why variables are useful for games, preferably
using concrete examples. For example, Super Mario Bros. uses variables to keep track of the time
remaining to complete the current level.
Anatomy of a Variable
Variables consist of a name (identifier), a type and a value. The name lets us use a variable
in the future, so that we can tell it apart from other variables.
score -> 24
The type, on the other hand, tells the system what kind of information a variable holds.
Some variables hold numbers. Others hold text.
Last but not least, the value is the actual information held by a variable.
StencylEducator’sKitLesson32
Scope
Scope tells us whether a variable is accessible throughout the entire game (global
variable) or if it pertains only to specific parts of a game, such as an individual actor (local
variables).
For now, we’ll only concern ourselves with global variables.
Question: When would it be useful to have local variables vs. just global variables?
Topic 3: Drawing
In order to complete the activity, students will draw the game’s score to the screen. It’s
appropriate to mention our coordinate convention for drawing.
When drawing graphics to the screen, our convention is to treat (0,0) as the top-left
corner.
Tip: If students haven’t been introduced to coordinate systems, skip this or convey using pictures.
StencylEducator’sKitLesson33