0% found this document useful (0 votes)
26 views

Lesson 6 - Creating Objects - Teacher's Guide: Cover The Topics Under Discussion Notes (Page 2)

The document provides guidance for a lesson teaching students to create new objects (actors) in a game. It includes an overview of the lesson, the intended outcome of further developing students' understanding of behaviors and code reuse, and a lesson plan outline consisting of a discussion on creating and referring to actors, an activity to extend an existing game by adding new actors, and an optional extra activity for students to demonstrate mastery.

Uploaded by

Erick Velez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Lesson 6 - Creating Objects - Teacher's Guide: Cover The Topics Under Discussion Notes (Page 2)

The document provides guidance for a lesson teaching students to create new objects (actors) in a game. It includes an overview of the lesson, the intended outcome of further developing students' understanding of behaviors and code reuse, and a lesson plan outline consisting of a discussion on creating and referring to actors, an activity to extend an existing game by adding new actors, and an optional extra activity for students to demonstrate mastery.

Uploaded by

Erick Velez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lesson 6 - Creating Objects - Teacher’s Guide

http://www.stencyl.com/teach/act6/

Overview

Introduce students to the idea of creating new actors (objects). Talk about the differences
between Actor Types and Actor Instances (Class vs. Object).

Outcome

Through the activity, students will create new actors (objects) on the fly, thereby further
developing their understanding of behaviors and code reuse.

Lesson Plan (1 - 2 hours)

Discussion Cover the topics under Discussion Notes (Page 2)


10 minutes Present the topics. Pose questions at appropriate points and encourage
students to participate in the discussion.

Activity Extend an existing game


50 minutes Students will apply what they’ve just learned to add functionality to an
existing game.

Activity Work on extra activities


60 minutes 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.

Stencyl Educator’s Kit ­ Lesson 6 ­ 1 
 
Discussion Notes

Topic 1: Creating Actors

Up until this point, students have been working with actors already placed inside a scene.
Now, they’ll learn how to create new actors on the fly and how to manipulate them.

Use the following block under Scene > Actors to create a new Actor.

The Actor Type is the kind of Actor you want to create. You can either choose a specific
Actor Type, or in some cases, you can plug in an Actor Type attribute, thereby letting you
change the kind of Actor Type that is created on a case-by-case basis.

X and Y represent the position, in absolute coordinates, at which to create the actor.

The final dropdown represents the drawing layer to place the actor on. Leave this at
Front.

Topic 2: Referring to Actors you just created

You’ll quickly discover that you’ll want to refer to the actor you just created. For example, if
you want to set its speed (to make it move).

How do you do this?

You may have noticed by now that many blocks that work with Actors have a dropdown
field that says Self.

Blocks that work with Actors need to know which actor they are referring to. Self
refers to the Actor to which the behavior is attached. For our Hero with a Walking
behavior, Self refers to the Hero.

Click on the dropdown, and you’ll discover more options.

Stencyl Educator’s Kit ­ Lesson 6 ­ 2 
 
Last Created Actor lets us refer to the Actor we just created.

Putting this all together, here’s an example where a bullet actor is created and given an
initial speed to move at.

Aside: The game may crash or act unpredictably if you attempt to use Last Created Actor before any
Actors have been created by you. Similarly, if you kill an actor that you just created and use Last Created
Actor, the game may crash.

Further Discussion: For more advanced classes, you may want to go over using Attributes to store
Actors for referencing in the future.

Stencyl Educator’s Kit ­ Lesson 6 ­ 3 
 

You might also like