Re-cap of yesterday

minedesertΛογισμικό & κατασκευή λογ/κού

31 Οκτ 2013 (πριν από 4 χρόνια και 2 μήνες)

144 εμφανίσεις

3/12/2013

1

Edith Cowan University






Research Centre for Transformational Games

Edith Cowan University

Perth
, Western Australia

Module 2

Introduction to Game Design and Development

Associate Professor Karen Murcia

Jason Morrison

Dr. Martin Masek

Edith Cowan University

Re
-
cap of yesterday


Research

Centre

for

Transformational

Games


Game

Engines


Unity
3
D

Navigation




Fun

with

Physics




Character

Controllers




Creating

a

‘Build’



Terrain

and

Vegetation




Water,

Light

and

Sky



Importing

External

Assets




Game

Environment

(level)

Design


Day

1

Challenge!










= Hands on (practical)

3/12/2013

2

Edith Cowan University

Outline of today


Day

1

Challenge

Review


Game

Mechanics


Scripts

in

Unity
3
D


Printing

to

the

console




Variables

and

interfacing

to

the

editor




MonoBehaviour



Wall

builder

with

touch



Accessing

our

other

components

and

other

GameObjects




Game

1
:

Collect

the

items



Timers



Game

2
:

Checkpoint

race




Day

2

Challenge!










= Hands on (practical)

Edith Cowan University

Game Engines have some useful
features

Day 1 Challenge Review

3/12/2013

3

Edith Cowan University

Game Engines have some useful
features

Game Mechanics

Edith Cowan University

Game Mechanics


The

“game

mechanics”

are

the

rules

of

the

game
.

For

example
:


When

the

player

collides

with

a

‘health

kit’

object,

the

players

health

will

increase

by

10

points
.


When

the

player

defeats

the

“boss”,

the

next

level

will

be

loaded
.


If

the

timer

reaches

0

before

the

player

reaches

the

next

checkpoint,

the

game

will

be

lost
.







3/12/2013

4

Edith Cowan University

Game Mechanics


Common

Game

Mechanics
:


Countdown

timers



build

tension
.


Points

awarded

for

doing

well



eg
.

earn

100

points

for

collecting

a

star
.


‘Achievements’



similar

to

points,

but

having

a

specific

representation
.

E
.
g
..

Earn

a

gold

medal

for

collecting

100

stars
.


Power
-
ups



increase

a

players

ability


Enemies



opponents

to

be

defeated


Adventure



stories

to

be

unlocked

by

solving

puzzles


Puzzles



various

kinds







Edith Cowan University

Game Mechanics


Specific

game

mechanics

are

often

unique

to

a

game
.


The

game

engine

will

provide

certain

constructs

to

build

common

mechanics


These

constructs

need

to

be

used

to

produce

specific

game

mechanics


周qs

⡵獵慬汹l

楮癯v癥v

獯浥

灲潧牡浭楮g
.




浯獴

敮ei湥n

g慭数污y

灲p杲慭g楮g



摯湥

獥灡s慴敬y



灲潧牡浭楮g

瑨t

敮杩湥



畳畡汬y



a

d楦晥牥湴

污湧n慧a,

捡c汥d

a

獣物灴楮s

污湧n慧a
.




獯浥

敮杩e敳e

瑨楳

捡c



d潮o



v楳畡汬y

c潮n散瑩湧

扬b捫猬

睩瑨

浩湩浡m

瑹灩湧

⡮潴



啮楴i
P
a

瑨潵杨t








3/12/2013

5

Edith Cowan University

Game Engines have some useful
features

Scripts in Unity3D

Edith Cowan University

Scripts in Unity3D


Unity
3
D

uses

a

scripting

framework

called

.
Net


.
Net

was

created

by

Microsoft,

but

Unity

uses

an

open
-
source

implementation

called

Mono
.


We

will

be

using

a

.
Net

language

called

C#

(C

Sharp)



alternatively

we

could

have

used

a

language

called

Javascript
.







3/12/2013

6

Edith Cowan University

Scripts in Unity3D


The

Unity

documentation

pages

include

a

scripting

reference
.







Edith Cowan University

Scripts in Unity3D


A

script

in

Unity

is

just

another

component

that

can

be

added

to

an

object
.

The

script

then

controls

that

objects

behaviour
.


Behaviour

that

is

not

particular

to

a

single

object

in

the

game

is

typically

assigned

to

an

“empty”

object

or

the

camera
.








3/12/2013

7

Edith Cowan University

Game Engines have some useful
features

Your first script



Printing to the console

Edith Cowan University

Printing to the console


Lets

create

a

first

script,

and

prove

that

it

works

by

having

it

print

a

message
.


Printing

messages

to

the

console

(text

output)

is

how

we

‘de
-
bug’

in

Unity
.


Print

values

of

variables,

to

check

that

they

have

been

assigned

the

correct

value
.


Print

a

message

as

proof

that

the

program

has

reached

that

point
.








3/12/2013

8

Edith Cowan University

Step 1


Create a scene


Create

a

new

scene,

add

a

cube

on

a

plane

and

a

directional

light
.


Save

the

scene
.


From

the

Unity

editor,

right
-
click

on

Assets

and

create

a

new

folder

called

Scenes


Move

all

your

existing

scenes

into

the

folder


Also

under

Assets,

create

a

new

folder

called

Scripts








Edith Cowan University

Step 1


Create a scene






3/12/2013

9

Edith Cowan University

Step 2


Create a script


Right
-
click

on

the

Scripts

folder

and

create

a

new

c#

script
.








Edith Cowan University

Step 2


Create a script


By

default,

the

script

is

called

NewBehaviourScript
,

change

its

name

to

myFirstScript
.








3/12/2013

10

Edith Cowan University

Step 2


Create a script


Scripts

need

to

be

added

to

an

object

in

order

to

run
.

Drag

the

script

onto

the

Main

Camera
.








An error results


we re
-
named the
script, but the old name still exists
inside the script file.

Edith Cowan University

Step 2


Create a script


Open

the

script

in

the

editor,

MonoDevelop
,

to

fix

the

error
.








Change the class name to
match the file name
-

myFirstScript

3/12/2013

11

Edith Cowan University

Step 2


Create a script


卡癥

瑨t

s捲楰c



䵯湯䑥v敬潰
,



扡捫



啮楴i

慮d

瑲t

摲慧杩湧

瑨t

獣物灴

潮瑯

瑨t

䵡楮

䍡浥ma

慧a楮
.








The camera should now have an extra
component shown in the inspector.

Edith Cowan University

Step 2


Create a script


乯瑥





捯畬d

h慶e

獡癥s

o畲獥汶敳

慬a

瑨t

瑲潵ble

慮a

捲敡瑥c

瑨e

獣物灴

畳楮g

‘Add

Component’



瑨t

楮獰散瑯爬

瑨楳

汥瑳

祯y

杩癥

瑨t

獣物灴

a

湡浥

摩牥捴汹

慮a

湡浥s

瑨t

捬c獳

瑨t

獡浥
.








3/12/2013

12

Edith Cowan University

Step 3


Examine the script


周q

獣物灴

摥晩d敳

a

捬c獳

睨楣w

楮i敲楴e

晲潭

瑨t

䵯湯j敨e癩v畲

捬c獳
.


Two

empty

methods

are

provided,

Start()

and

Update()


These are
overridable


methods of
MonoBehaviour








Edith Cowan University

Step 4


The Start method


周q

獴慲s

浥m桯h

牵湳

潮捥,

扥景牥

慮a



瑨t

異u慴a

浥m桯hs

慲a

捡c汥d
.

啳r

瑨楳





慮a

楮楴楡汩s慴楯a
.




祯y

慲a

晡f楬楡i

睩wh



灲潧牡浭楮本

y潵

歮潷

a扯bt

‘constructors’



畳u

瑨t

却慲琨)

浥m桯h



a

捯湳瑲畣瑯r

⡲慴桥a

瑨慮

a

浥m桯h

睩瑨

瑨t

獡浥

湡浥



瑨t

捬c獳s








3/12/2013

13

Edith Cowan University

Step 4


The Start method


䅤d

a

灲楮p

獴慴敭敮e



瑨t

却慲p

浥m桯h


卡癥

瑨t

獣物灴s



扡捫



畮u瑹

慮a

牵r

⡰E敳e

灬p礩








Edith Cowan University

Step 4


The Start method


周q

浥獳慧m



摩獰d慹敤



瑨t

扯b瑯t



瑨t

啮楴i

e摩瑯d

睩湤nw


䍬楣C





⡯E

瑨t

捯湳cle

瑡戩



獨潷

瑨t

捯湳潬e

睩瑨

慬a

瑨t

浥獳慧敳

瑨慴

睥牥

来g敲慴敤
.








3/12/2013

14

Edith Cowan University

Step 4


The Start method


䝥d

潵o



条浥

浯me

⡡湹

捨慮来g

浡摥

睨i汳l

啮楴i





条浥

浯摥

慲a

摩獣d牤敤

潮捥

祯y

来g

潵o



条浥

浯摥m


䑲慧

瑨t

獡浥

獣物灴

潮瑯

瑨t

捵扥,

慮a

牵r

慧a楮
.


You

should

see

two

‘hello

world’

messages

in

the

console
.









Edith Cowan University

Step 4


The Start method




睡湴



歮潷

睨o



獡祩湧

桥h汯,



浯摩晹

瑨t

獣物灴
W










Each script gets a ‘handle’ to the object it belongs to


referred to by the
variable name ‘this’.

Writing ‘this’ is optional (its implied)


string
objectName

= name; would
also work here.

3/12/2013

15

Edith Cowan University

Step 5


The Update method


啰摡瑥



捡汬cd

潮oe

灥p

晲慭f


.
e
.

䕶b特

瑩浥

瑨t

獣牥敮


-
摲慷猩










Be careful! If we run at 60 frames per second, that's a lot of calls to
Update()


the more code here, the slower the game will run.

Edith Cowan University

Step 5


The Update method


䍨慮来

瑨t

啰d慴a

浥m桯h



灲楮p

瑨t

x

灯p楴楯i

癡汵v



瑨t

䍵扥

潢橥捴
.










3/12/2013

16

Edith Cowan University

Step 5


The Update method






条ge

浯摥m

獥s散e

瑨t

捵扥

慮a

浯摩晹

楴i

x

灯獩瑩tn



瑨t

楮獰散瑯s



瑨t

癡v略u

獨潵汤

異u慴a



瑨t

捯湳c汥
.










Edith Cowan University

Game Engines have some useful
features

Variables and interfacing to
the editor

3/12/2013

17

Edith Cowan University

Variables and the Editor


剥浯me

瑨t

獣物灴

晲潭

瑨t

䵡楮

䍡浥ma

⡲楧桴
-
捬c捫



瑨t

楮s灥捴潲

慮a

獥汥捴

剥浯me

䍯C灯湥湴p
.

乯w

瑨t

獣物灴

獨潵汤





瑨t

捵扥

潮oy
.


䵯摩晹

瑨t

獣物灴

慮a

牵r
W











Add some variables

(‘f’ means float


otherwise it assumes
double and you get an error)

Perform a rotation of the object

Edith Cowan University

Variables and the Editor






Variables declared public are exposed to
the inspector and can be modified at
runtime.

3/12/2013

18

Edith Cowan University

Variables and the Editor






Degrees per second

Time elapsed since last
update call

Rotation about x, y, and
z axis


When

animating



use

Time
.
deltaTime

to

update

the

transform
.

Our

code

will

always

rotate

at

0
.
1

degrees

per

second
.


If

you

don't

use

Time
.
deltaTime

-

speed

will

be

affected

by

framerate
.






Edith Cowan University

Step 5


The Update method







坨敲t

摯敳

瑨t

瑲慮景牭
.
副瑡te

晵湣瑩潮

捯浥

晲潭o


All

the

things

you

create

in

Unity

are

based

on

the

GameObject

class
.

This

has

some

variables

and

functions

defined
.



GameObjects

have

a

Transform

object,

which

has

some

variables

and

functions

defined
...


坨敲t





晩fd

潵o

睨慴

慬a

瑨敳t

癡物慢l敳

慮a

晵f捴楯湳

慲政


In

the

Unity
3
D

documentation!


䝯d瑯t


桴h瀺p⽤潣献畮楴礳搮捯洯䑯捵浥湴慴楯港卣物灴剥晥牥湣攠
慮a⁳敡牣栠 潲o
䝡d敏扪散e




3/12/2013

19

Edith Cowan University

Variables and the Editor







䅦瑥A

祯y

晩湤

䝡d敏扪散b
,

捬c捫



呲慮獦q牭

⡣慰楴慬





獥s

楴i

摯捵浥湴慴楯m
.






Edith Cowan University

Variables and the Editor







乯k



歮潷

睨敲w



晩湤

晵f捴楯湳

瑨慴



捡c

捡汬



潵o

䝡d敏扪散瑳
.


The

MonoDevelop

editor

includes

auto

completion,

so

an

alternative

way

to

explore

functions

is

to

type

the

object’s

name

(or

‘this’),

followed

by

a

period

(‘
.
’)

and

the

editor

will

show

you

the

options

for

what

can

go

next
.






Variables

/ Objects

Functions
(methods)

3/12/2013

20

Edith Cowan University

Game Engines have some useful
features

MonoBehaviour

Edith Cowan University

Mono Behaviour







䍯m楮i

扡捫



潵o

s捲楰c





歮潷

慢潵t

瑨t

却慲t

慮d

啰摡瑥

晵湣瑩潮
.

坨慴

敬獥



瑨敲政


Our

class

inherits

from

MonoBehaviour
,

so

the

complete

list

is

in

the

MonoBehaviour

reference

page
.






3/12/2013

21

Edith Cowan University

Mono Behaviour







周q


潶敲物摡扬e


晵湣瑩潮t

慲a

o湥n



捡c

業灬敭敮e



潵o

獣物灴
.






These are called on
‘mouse’ events
-

can be
from a mouse, or touch
enabled screen

Trigger and collision events are called when
something comes in contact with your object


more on these later.

Edith Cowan University

Game Engines have some useful
features

Wall builder with touch

3/12/2013

22

Edith Cowan University

Wall builder with touch







䱥瑳

桡癥

獯浥

晵f

睩瑨

瑨t

佮l潵獥䑯睮

浥m桯h


Create

a

new

script

touchBehaviour
.
cs

and

add

an

OnMouseDown

method

as

shown

here
:







Edith Cowan University

Wall builder with touch









瑨t

啮楴i
P
a

敤楴潲



獥s散e

瑨e

捵扥,

牥浯癥

瑨t

潬o

獣物灴

慮a

摲慧



瑨t

湥n

瑯畣桂敨e癩v畲

獣物灴
.


Since

the

script

refers

to

a

RigidBody
,

and

we

have

not

added

one

to

the

cube,

the

console

will

show

an

error

when

you

click

on

the

cube
.




䅤d

a

剩oi摂o摹

灨p獩捳

捯浰潮敮o



瑨t

捵扥

慮d

瑨t

敲e潲

獨潵汤

摩獡灰p慲
.


When

you

click

on

the

cube

in

game

mode,

it

will

jump

up

in

the

air
.





3/12/2013

23

Edith Cowan University

Wall builder with touch







周q

湥xt

s瑥t





扵楬b

a

睡wl



捵扥s
.



捯畬d



瑨楳

浡湵ml汹





摩d



䑡y

N
,

扵b



睩ll





瑨牯畧t

潵o

獣物灴
.




浡步

瑨楳

e慳礬



睩wl

捲c瑥

a

‘Prefab’



瑨t

e摩瑯d
.

偲敦慢m

慲a

獴潲敤

瑥浰m慴敳



潢橥捴o

瑨慴

桡癥

扥敮

捲敡瑥c
.

佮捥

祯u

h慶a

a

灲敦慢

祯u

捡n

浡步

m畬瑩灬e

捯灩敳




.






Edith Cowan University

Wall builder with touch







䍲敡瑥

a

景汤敲

畮摥u

䅳獥瑳

慮a

摲慧

瑨t

䍵扥

i湴n



晲潭

瑨t

楮獰散瑯s
.


Now you can drag multiple cubes

into your scene, but lets do this

through another script.






3/12/2013

24

Edith Cowan University

Wall builder with touch







䍲敡瑥

慮a瑨敲

獣物灴s

捡c汥d

睡汬䉵B汤敲






Based on: http://docs.unity3d.com/Documentation/Manual/InstantiatingPrefabs.html

Creating a copy of this

At a location

Without changing its rotation

Edith Cowan University

Wall builder with touch







䍲敡瑥

慮a瑨敲

獣物灴s

捡c汥d

睡汬

扵b汤敲






Based on: http://docs.unity3d.com/Documentation/Manual/InstantiatingPrefabs.html

We are instantiating (creating a)
brick, but what is brick?

3/12/2013

25

Edith Cowan University

Wall builder with touch









瑨t

啮楴i

敤e瑯爬

d牡r

瑨t

睡l求l楬摥i

獣物灴

潮瑯

䵡楮

䍡浥ma
.


Brick is ‘None’, and if you try

to run you will get an error

indicating this.


Drag the Cube prefab into the

Brick variable to fix this.






Edith Cowan University

Wall builder with touch







䝯楮d

楮瑯

条浥

浯摥

獨潵汤

来g敲慴e

a

睡汬



捵扥s


Click

on

a

cube

to

apply

a

force


Change the script so that the amount and direction of force applied
will demolish the wall.






3/12/2013

26

Edith Cowan University

Wall builder with touch







乯瑥
W

䥮f瑥慤



捲敡瑩湧

a

灲敦慢

慮a

来瑴楮g

楮獴慮s敳







捯摥c



捯畬c

桡癥

摯湥



瑨t

桡牤

睡y

慮a

扵楬i

潵o

灨祳p捳

捵扥s



捯摥
.






Do the same thing

Edith Cowan University

Game Engines have some useful
features

Accessing other
GameObjects

3/12/2013

27

Edith Cowan University

Accessing other
GameObjects







卥癥牡v

睡祳



慣捥獳

潴桥o

条浥

潢橥捴o

晲潭

a

獣物灴
W


Assign

them

to

variables

through

the

inspector

(we

have

seen

this)


Locate

them

by

name

or

tag

(using

GameObject
.
Find
)


Get

them

passed

in

as

parameters

(
eg
.

when

using

Triggers)



䱥瑳

汥慲a

浯me

慢潵a

瑨敳t

瑨牯畧t



數慭灬a
.






Edith Cowan University

Game Engines have some useful
features

Game 1: Collect the items

3/12/2013

28

Edith Cowan University

Game 1: Collect the items







周q

a業







慢汥



“collect”

i瑥t猬

敡牮楮e

a

獣潲s

瑨慴



摩獰污祥y



瑨t

獣牥敮
.


䙯c

瑨楳



湥敤
W


An

object

to

display

the

score

on

the

screen

(along

with

score

management

functionality)


A

pickup

item

object

that

increases

the

players

score

on

collision

and

deletes

itself






Edith Cowan University

Step 1: Create the objects


䍲敡瑥

a

湥n

獣敮s

⡤潮❴

景牧整



獡癥

瑨t

潬o

潮攩


䅤d
W


A

Plane


A

3
rd

Person

controller


A

Cube


A

Directional

Light


A

GUI

Text






3/12/2013

29

Edith Cowan University

Step 1: Create the objects


呵牮

瑨t

䍵扥

i湴n

a

呲楧q敲



瑨楳

睩wl

敮慢汥



呲楧q敲

晵湣瑩潮f



䵯湯j敨e癩潵v






Edith Cowan University

Step 2: Line up and rename the
GuiText




楮瑯

2



P

浯摥m

牥湡浥

瑨t

䝵楔數t



卣p牥䍯畮瑥t
,

灯獩瑩潮





瑨t

条浥

癩vw

慮a

楮捲敡獥

瑨t

景湴

獩穥






3/12/2013

30

Edith Cowan University

Step 3: Add the
ScoreScript


䅤d

a



獣物灴

c潭灯o敮e



卣p牥䍯畮瑥u
,

捡汬



卣p牥卣物灴
.

䕤楴





瑨t

景汬潷o湧
W






Define a
variable score
and a public
function to
increase it.

When drawing
a frame, draw
the current
score

Edith Cowan University

Step 4: Add the Pickup script


䅤d

a



獣物灴

捯c灯湥湴



瑨e

䍵扥C

捡汬



偩捫cp
.

䕤楴





瑨t

景汬潷ong
W






Calling the
increaseScore

method of the
ScoreCounter

3/12/2013

31

Edith Cowan University

Step 5: Add more cubes


偬慣m

捯灩敳



瑨t

䍵扥

慲au湤

瑨t

l敶敬



捲敡瑥

浯me

灩捫pp

潢橥捴o
.


呥獴

瑨t

汥癥v



浡步

獵牥



睯牫r






Edith Cowan University

Step 6: Add a winning condition


䵯摩晹

瑨t

卣p牥卣r楰i



楮捬畤e

a

睩n湩湧

浥獳慧m

o湣n

瑨t

灬p祥y

牥慣桥r

a

捥牴慩a

獣潲s
.






3/12/2013

32

Edith Cowan University

Step 7: Changing text colour




祯y

睡湴



捨慮来

瑨t

捯c潵o



瑨t

瑥t琬

浯摩晹

瑨t

却慲p

浥m桯h



瑨t

卣p牥卣物灴
.






Edith Cowan University

More work?


周q

捯湣数c

捡c



數瑥td敤
W

灩捫異p

瑨慴

浯摩晹

灡牡浥瑥牳



瑨t

瑨楲t

灥牳pn

捯湴牯汬敲

潢橥捴

⡦慳瑥爬

扩b来爬

獭慬s敲e

整e
⸮⸮
)


呲楧q敲e

捡c



畳敤

景f

浯me

瑨慮

灩捫pp

楴敭i


Trigger

a

conversation

when

approaching

a

character
.


Checkpoint

trigger

that

gives

you

more

time

in

a

race


Trigger

that

opens

a

door


Trigger

that

spawns

an

enemy






3/12/2013

33

Edith Cowan University

Global Variables


䅮潴桥o

睡y



獨慲s

楮景牭慴楯a

慭潮杳a

o扪散bs





畳u

杬g扡b

癡物慢v敳



摥捬慲敤

畳楮g

‘public

static’






Any other script can access this variable using
ScoreScript.gameOver

Edith Cowan University

Game Engines have some useful
features

More on Triggers

3/12/2013

34

Edith Cowan University

Triggers


A

瑲楧来g



j畳u



慲敡



祯y

捡n

瑵牮

潦f

瑨t

䵥獨剥j摥牥d

捯浰潮敮t

慮a



睩汬

獴楬s

睯牫






Cube trigger with renderer
turned off

Just some cubes re
-
named
with fancy names


drag
objects onto each other to
give them a parent/child
relationship. Now when
RobotCollider

is destroyed, so
will the children.

Edith Cowan University

Game Engines have some useful
features

Timers

3/12/2013

35

Edith Cowan University

Timers


併l

条浥

浩杨m



a

湩捥

‘treasure

hunt’



扵b



浡步



浯me

晵f



湥敤n

獯浥

捯湦汩捴
.


A

獩浰汥

o灰潮p湴

景r

瑨t

灬pyer

捡c





瑨t

景牭



a

瑩浥t
.


䍯畮瑩湧

摯睮

瑨t

瑩浥



a

汯獥

捯湤楴ion

扵楬摳

獯浥

瑥湳楯n

慮a

来g

瑨t

慤牥湡a楮

灵浰p湧
.







Edith Cowan University

Timers


周q

瑩浥

敬e灳敤

捡c



潢瑡o湥n



瑨t

晵湣瑩潮

呩浥
.
瑩浥


If

you

want

it

as

a

string

to

be

printed

to

a

GUIText
,

use
:

Time
.
time
.
ToString
()
;


If

you

just

want

an

integer,

use
:

((
int
)
Time
.
time
)
.
ToString
()
;








3/12/2013

36

Edith Cowan University

Adding a Timer


䅤d

慮a瑨敲

䝕䥔數t

䝡d敏扪散e


Change

its

name

to

TimerDisplay


Line

it

up

in

the

game

view


Set

the

font

size


Add

a

C#

script,

call

it

CountDownTimer








Edith Cowan University

Adding a Timer


䕤楴

瑨t

䍯畮瑄潷湔業敲

獣物灴
W







3/12/2013

37

Edith Cowan University

Adding a Timer


卡癥

瑨t

獣物灴

慮a

牵r

瑨t

条浥


We

have

a

Count

Up

timer

instead

of

Count

Down!


Exercise
:

Modify

the

script

to

make

the

counter

count

down


Need

a

variable

to

store

the

initial

starting

value

of

count


Need

to

store

the

time

from

the

previous

frame


Need

to

work

out

how

much

time

elapsed

since

the

previous

frame


Need

to

decrement

the

count

by

the

right

time


Add

a

message

when

the

count

reaches

zero





Hint:
Time.deltaTime

will give us this

Edith Cowan University

Adding a Timer


卯汵瑩潮
W







3/12/2013

38

Edith Cowan University

Game Engines have some useful
features

Game 2: Checkpoint race

Edith Cowan University

Checkpoint Race


䍲敡瑥

a

条浥

睨敲e
W


The

player

needs

to

run

from

a

start

to

a

finish
.


A

timer

counts

down

from

the

start

and

the

game

is

lost

if

the

timer

reaches

zero
.


Add

a

number

of

checkpoints

to

the

level



passing

a

checkpoint

increases

the

time

on

the

timer
.


Add

some

pickup

items


One

that

increases

player

speed


One

that

increases

player

score


Use

placeholder

art

(i
.
e
..

Boxes)





3/12/2013

39

Edith Cowan University

Game Engines have some useful
features

Day 2 Challenge!

Edith Cowan University

Day 2 Challenge


Singly or in Pairs


䍲敡瑥



潵瑤潯o

浡m

睩wh

a

湵浢敲



獥s瑩湧t

⡵獥

灬p捥桯汤敲

扯b

慲琩
W


Forrest


Lake


Village


Farm


Add

a

number

of

(box)

characters

to

the

settings
.


A

central

character

in

the

village

will

give

the

player

“quests”


A

quest

consists

of

some

errands

(e
.
g
..

bring

a

fish

from

the

fisherman

at

the

lake

to

the

farm

to

earn

$
20
...
)


Use

GUIText

to

show

text

spoken

by

the

characters

and

some

variables

to

keep

track

of

quest

state

and

progression
.


Prize

for

the

best

implementation
.