2DGameplayTutorial.pdf

(2669 KB) Pobierz
2D Gameplay Tutorial (20080219)
2D
Gameplay
Tutorial

Providing
2D
Gameplay
with
Unity
2
Author:
Graveck
Interactive
Last
Revision:
19­FEB­2008
197798426.004.png 197798426.005.png
Contents
Why
2D
is
the
Bee's
Knees

4
Prerequisites

6
2. Setting The Scene
Getting
in
the
2D
Mind­Set

7
A
Closer
Look

9
Setting
the
Level
Attributes

10
Object
Profile:
Level
Attributes

12
Object
Profile:
Death
Zone

13
Setting
Up
the
Platforms

13
Object
Profile:
Platform
(Prefabs)

15
Object
Profile:

Pre­Assembled
Platform

16
Introducing
Lerpz,
Our
Lovely
Character

17
Placing
Lerpz

18
Directing
the
Camera

19
Object
Profile:
Character
(Lerpz)

20
Lighting
our
Scene

22
Spicing
up
the
Character

24
The
Camera

26
Object
Profile:
Main
Camera

27
Continuing
our
Level

28
Script
Profile:

CameraTargetAttributes

28
Handling
Rigidbodies

29
Object
Profile:
Crate

30
Exercise

31
Moving
Platforms

32
Object
Profile:
Moving
Platform

33
The
Spaceship

34
Object
Profile:
Spaceship

35
Well
Done!

36
3. Delving Deeper: Scripting Examples
Studying
the
Scripts

38
Moving
Platform
Particle
Effects

38
197798426.006.png
The
Camera
Scrolling
Script

40
Streamline
Your
Workflow

41
Spaceship
Script
Part
1:
Defining
Helper
Classes

43
Spaceship
Script
Part
2:
Controlling
the
Spaceship

44
Spaceship
Script
Part
3:
Special
Effects

47
Finished!

47
4. What's Next?
Your
Turn

48
197798426.007.png
Introduction
Sometimes
2D
gameplay

calls
and
you
can't
resist
its

alluring
charm!
Unity
can

handle
it.

This
tutorial
shows
the

steps
you
need
to
create
a

basic
2D­style
platform

game.
Why
2D
is
the
Bee's
Knees
It
is
no
secret
that
Unity
can
help
you
create
great
three­dimensional
games
with
ease.

Its
raw
power
and
flexibility
allows
even
beginners
to
create
impressive
games
with­
out
much
difficulty.
Unity
is
undoubtedly
a
great
3D
game
engine
­­
so
why
on
earth

would
you
want
to
create
a
2D
game
with
it?
For
certain
game
types,
that
extra
"D"
in
3D
can
be
a
hindrance.
Some
games
simply

work
better
with
two­dimensional
gameplay
mechanics.
Think
of
those
simple
and
fun

2D
side­scrolling
games
you
have
played
in
the
past,
or
maybe
you
have
a
simple
puz­
zle
game
idea
that
would
work
best
constrained
to
two
dimensions
­­
the
list
keeps

going
but
the
bottom
line
is
many
games
can
benefit
by
the
use
of
only
two
dimen­
sions.

Two­dimensional
games
are
also
commonly
easier
for
the
casual
gamer
to
understand,

which
is
something
to
consider
if
you're
a
small
game
developer
(see
the
article
"Cas­
ual
Games
as
a
Business").
Luckily,
Unity
is
extremely
flexible
and
can
easily
handle
2D
gameplay!
Its
world
class

Ageia
PhysX
is
highly
adaptable
and
can
be
constrained
in
many
ways
including
two

dimensions.

In
this
tutorial
we
define
a
2D
Game
as
a
game
where
graphics
are
still
in
3D,
but
re­
stricted
motion
causes
the
physics
and
gameplay
only
to
occur
in
a
single
2D
plane.

This
lets
us
use
3D
models
for
our
content
and
makes
life
easier
for
artists
and
devel­
opers
alike.
One
could
say
that
we're
using
the
best
of
both
worlds:
the
ease
of
2D

197798426.001.png 197798426.002.png
gameplay
and
the
beauty
of
3D
graphics
­­
with
the
added
attraction
that
existing
de­
velopers
already
have
a
good
3D
asset
production
pipeline
in
place.

This
tutorial
will
guide
you
in
building
a
2D
platform
game.
We
have
designed
this

tutorial
with
beginner
/
intermediate­level
users
in
mind;
we
only
ask
that
you
have
a

baseline
knowledge
of
Unity.
We
have
also
included
some
advanced
concepts
that

may
be
of
interest
to
more
seasoned
users.

We
begin
by
getting
you
into
the
2D
mind­set.
Then
we
will
walk
you
through
build­
ing
a
2D
world
in
which
your
character
will
move
around.
After
adding
a
few
cool
ob­
stacles
and
scenery,
we'll
lastly
add
a
rocket
ship
for
the
player
to
fly.

We
hope
you
enjoy
this
tutorial
as
much
as
we
had
fun
creating
it!
The
tutorial’s
demo
level
in
action.
5
197798426.003.png
Zgłoś jeśli naruszono regulamin