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

Game Dev 1_ Lesson 3 - Spawnable Properties

This lesson plan focuses on teaching students about spawnable properties in game development, specifically how to describe, access, and assign values to object properties. It includes activities for debugging and independent practice using CodeCombat, along with key terms related to properties, object types, and instances. The plan encourages reflection on learning experiences and challenges faced during the coding process.

Uploaded by

SOE LIN HTET
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Game Dev 1_ Lesson 3 - Spawnable Properties

This lesson plan focuses on teaching students about spawnable properties in game development, specifically how to describe, access, and assign values to object properties. It includes activities for debugging and independent practice using CodeCombat, along with key terms related to properties, object types, and instances. The plan encourages reflection on learning experiences and challenges faced during the coding process.

Uploaded by

SOE LIN HTET
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Lesson Plan

Game Development 1

Quest #3
Spawnable Properties
Quest #3
By the end of my quest, I will
be able to…

💎 Describe the properties


of an object that I have
spawned into my game.
💎 Access and use the
values stored in object
properties.
Properties

“griffin” “polar bear” “unicorn pug”


Reminder: Object Property
We often represent properties as variables. These variables describe each
instance of an object type. For example, these are all instances of heros.
They all have a name property. The strings stored in name differs,
depending on the instance you’re examining.

name = “Tharin” name = “Anya” name = “Illia” name = “Okar”


Accessing Hero Properties
Here are some hero properties to access in your games:

Property: How to Access:


● maxSpeed player = game.spawnPlayerXY(“goliath”, 20, 20)
● maxHealth player.maxSpeed
● health player.maxHealth
● attackDamage player.health
player.attackDamage

Notice a pattern?
objectName.propertyName
Assigning Properties to New Values
Sometimes you will need to assign properties to new values:

Property: How to Change:


● maxSpeed player = game.spawnPlayerXY(“goliath”, 20, 20)
● maxHealth player.maxSpeed = 100
● health player.maxHealth = 50
● attackDamage Player.health = 25
player.attackDamage = 88

Notice a pattern?
objectName.propertyName = new value
Warm-Up Activity:
Imagine you are creating a
game where you need to set
your hero’s max health value to
450 instead of the default 350.
What statements would you
write in order to spawn Lady
Ida Justheart into the scene and
immediately update her max
health value to 450? type = “champion”
Warm-Up Activity: Solution
To Game Dev Island!

Let’s put these


concepts into
action!
Game Recap: Forest Incursion
👀 How did you change the
properties of Goliath?

1 game.addDefeatGoal()
2 game.addSurviveGoal()
3 player = game.spawnPlayerXY(...)

💬 What statements do we need to


write in order to access and assign
the player’s properties?
Reminder: Debugging!
You’re going to make mistakes. That’s a very NORMAL part of coding, even
for experts.
Finding and fixing errors (debugging) is one of the hardest things to do.
Consider using the following tools when writing your CodeCombat programs:
1. IDE Error messages
2. Comments
3. hero.say() or print() We will use
4. Tracing tools CodeCombat error
5. Visualization tools messages,
6. Debuggers comments and
7. Unit tests (advance) hero.say in Game
Dev 1 to debug!
Activity: Debugging
The fire-spewer is
supposed to throw
flame balls in a vertical
direction. However, it
does not work as
intended.
1.
1 Where is the error?
2.
2 How would you fix
this mistake?
Independent Practice
Log into CodeCombat
https://codecombat.com/

Play Levels
Game Dev 1 Levels 12 - 17

Bonus Activities:
Level 3 of Hour of Play: https://hourofcode.com/ccplay

Need Help?
Always try it once before asking for help.
Summary of Key Terms
● Property: A variable that describes a particular
characteristic of an object.

● Object Type: A group of objects that all share the


same properties.

● Instance: A specific example of an object type. For


example, Anya is an instance of the hero type.
Reminder…
● Spawning: The act of creating a new object in a
scene while a game is running.
● Game Mechanic: The rules that govern how a player
interacts with a game and how a game interacts with
a player.
What did you discover?
What I did:
-How many levels did you finish? What was your favorite
level?

What I noticed:
-What did you notice as you played through the levels?
-Did you discover or learn something new?

What was challenging?


-Was something confusing about the code or the challenge?
-Do you need more practice on a specific level?

15
Any Questions?

16
Wrap Up
These are all instances of what object
type?

Instances

What properties do they all share?


Wrap Up
Add your own
formative question.

You might also like