ah teaches game design and development (The core lecture)

The core

Lecture outline

Debugging, feedback and iteration in game design and development. Lecture slides will be made available on the day of the lecture.

P3: Playtesting
P4: A Mini Game

Questions?

Questions?

Any questions about the critical play reflection?

Code tutorial

Today's tutorial covers building objects. Let's talk a bit about this first.

Type and objects

In the course so far, we have seen 'types' of variables:

We have also seen the an object already with arrays.

Objects in JavaScript

Objects are a collection of properties and methods (functions). We have seen this before:

stars.length; // a property of an array that returns the length of the arrayconsole.log(); // a method (a function connected to a object)

Objects

A clean way to bundle the states and behaviours of a component in our game. In our game so far we have had two 'major' components: the player and the obstacle.

Let's break apart our existing obstacle code and assemble the pieces of the object.

new

new is an operator that will specify we are building an object or class. In JavaScript this is the closest we get to 'object-oriented programming.'

Building objects

Creating a new object requires:

this

this is a reference to something else. What it references depends on where it is called.

When we are building our objects we will use this as a reference to the object that has been created.

To the computers!

1/1