Professional Documents
Culture Documents
Lab 8 - 2D Platformer p1 - New
Lab 8 - 2D Platformer p1 - New
PLATFORMER P1
INFO 4328 – Game Design
& Development (DIS/KICT)
12/6/23
INTRODUCTION
Start by creating a 2D
project.
Note that there is no
directional light in a 2D
game.
06/12/2023
ORTHOGRAPHIC CAMERAS
06/12/2023
TILEMAP Import the tilemap asset
from the Asset Store (Pixel
Explore the Sprite provided.
06/12/2023
TILEMAP
Give it a name.
06/12/2023
TILEMAP
•In order to draw, we need a palette.
Order
06/12/2023
TILEMAP
06/12/2023
TILEMAP
We can now draw with the
tile.
Choose any one and click on
the scene.
As you can see, the size of
the tile does not fit the Grid.
06/12/2023
TILEMAP
To fix this, select all the tiles in
the original sprite (by selecting
the sprite).
In the Inspector, change the pixel
per unit to size of the Slice (16
for the asset that I’m using).
To draw the same tile multiple
times, left-click the mouse and
move it around the scene.
06/12/2023
TILEMAP
• If you have a background, you can
add it to the scene (Create Empty à
Add Add Sprite Renderer component).
06/12/2023
TILEMAP
You can decorate the levels with other objects as
Decorate desired.
06/12/2023
SLICING SPRITE
1 2 3 4 5
06/12/2023
USING THE NEW
INPUT SYSTEM
•Open Package Manager.
Open
06/12/2023
Select the Sprite you want to use as the Player (choose
the one with Idle animation).
If you’re using your own Sprite, you will need to slice it.
PLAYER
temporarily no tray to expand.
06/12/2023
•If you don’t want to use Automatic, then Set Type to Grid by
Set Cell Size and adjust the grid to fit your sprite.
MOVING Notice
•Notice that the borders are now more even.
PLAYER
•Click Apply to save the changes and close the Sprite Editor
Click (Automatic or Grid by Cell Size).
•Look at your sprite in the Project view and note that the tray
Look now contains all the individual frames, ready for animation.
06/12/2023
MOVING
PLAYER
•Create a new folder in Assets, name it Animation.
Create
06/12/2023
Before we can move
the Player, we need
Hit play. Notice that to add a Rigidbody
the character is 2D component to it,
as well as Collider
animated. (Box/Capsule/Circle
06/12/2023
MOVING
PLAYER
Create a new folder – Scripts.
06/12/2023
MOVING
PLAYER
• First, create the Action Maps by clicking
Create the ‘+’.
• Name it as Ground.
Name
06/12/2023
MOVING
PLAYER
• In order to be able to control the
player using the Input Actions, we
Order need to generate the C# script.
• Hit Apply.
Hit
06/12/2023
MOVING
PLAYER
06/12/2023
MOVING
PLAYER
• Now, create a new script –
Create PlayerMovement.
06/12/2023
MOVING PLAYER
06/12/2023
MOVING PLAYER
Select Move and change the Action Type to Value/Pass Through (for
continuous movement), Control Type to Axis.
06/12/2023
MOVING PLAYER
You’ll notice that the
Hit Play to test. object is rotated instead
of moving linearly.
Test again.
06/12/2023