Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 1 - Introduction and Objects

Similar presentations


Presentation on theme: "Week 1 - Introduction and Objects"— Presentation transcript:

1 Week 1 - Introduction and Objects
Game Design Week 1 - Introduction and Objects

2 Competition! Your Hero Broad theme, be creative
The more creative and interesting your take, the better Focus will be on design and ideas, not programming

3 What is a game?

4 What is a game? A game is an activity played using a sets of rules
There are many types of games Board games Video games Card games Word games Sports General concepts apply across the board for games We’ll be focusing on mechanics as we start out

5 Game General Concepts Games (especially video games and board games) can be made up of any number of a few different elements: Mechanics Visuals Narrative Games will ALWAYS have mechanics, but not always visuals or narrative, and are always interactive in some way We’ll be focusing on mechanics as we start out

6 Game Mechanics So let’s talk about game mechanics
Can someone give me an example of a game mechanic?

7 What are mechanics? Rules that together form the constraints and functionality of the game Defines how things like combat, interactions, etc work Mechanics are the absolute core of any game

8

9

10 What games do you play? What mechanics does the game have?
Your examples? What games do you play? What mechanics does the game have? So let’s talk about game mechanics Can someone give me an example of a game mechanic?

11

12 Breaking down mechanics
Breaking blocks in Minecraft

13 Breaking down mechanics
Breaking blocks in Minecraft Player clicks the left mouse button (click event) Character’s arm punches (animation) Character’s arm checks to see if it’s hitting a block (collision detection) If block is being hit, it starts to break (damage) When click is held down, this repeats until the block takes enough damage to break Let’s break down breaking down So what does this rely on? Tamara talked about events in web

14 Let’s look at the elements
Player Character Character skin Animations Interactions from events Movement, punching, placing blocks Block Type Texture Damage limit How do we define these things in code? These have loads of parameters associated with them. There are loads of block types with different textures, uses and damage limits We can’t define those with the code we know right now, so how do we do it?

15 Objects

16 What is an Object? In real life, an object can be anything! (seriously) All objects in the world have properties - for example, a car has a color, weight, max speed, and loads of other stuff Some objects have methods - like functions or actions - for example, a car can start, drive, break, etc Lets think about what our car object needs as an example

17 The Base Object We use objects in games when we want to create a sort of “model” of how something should be described For example, a “car” is made up of a main body with 4 wheels that can drive, stop, and change directions These details remain the same, regardless of the car, but other things like the color, size, speed etc can change Lets think about what our car object needs as an example

18 The Base Object A JavaScript object is essentially a collection of:
Properties; variables with values that describe aspects of the object, and Methods; functions which describe what actions the object can take, or what it can do Lets think about what our car object needs as an example

19 Object Properties Name: Tesla Roadster Color: Red Year: 2019
Top Speed: 250+mph Name: FIAT 500 Color: White Year: 2008 Top Speed: 120mph Now we can use our new constructor function to create different cars, using the same properties! We just add in the values we want to use in the arguement list for the constructor

20 Objects can be written like variables, but use { }
Each property take the form of ⇒ property : value Lets think about what our car object needs as an example

21 Working with Properties
The values of properties can be accessed using object.property What will the following give us: car.name car.weight Lets think about what our car object needs as an example

22 Adding an object Method
Lets think about what our car object needs as an example

23 Working with Methods Methods can be easily run from objects using object.method() So what do you think will happen if we say car.drive()? HINT: In JavaScript, the thing called this, is the object that "owns" the method/property. Lets think about what our car object needs as an example

24 Other ways of creating objects
Lets think about what our car object needs as an example

25 Other ways of creating objects
Lets think about what our car object needs as an example

26 Other ways of creating objects
Lets think about what our car object needs as an example

27 Useful Links W3Schools Javascript Objects
W3Schools Javascript Object Constructors


Download ppt "Week 1 - Introduction and Objects"

Similar presentations


Ads by Google