Unity Pacman - Weebly
Pacman Note: I have started this exercise for you so you do not have to make all of the box colliders. If you want to see how the maze was created, open the file named "unity_pacman_create_maze." Adding Pac-Man The Pac-Man Sprite Now it's time for the most important part of our game: Pac-Man. We will need one animation for each movement direction: - right - left - up - down All the animations are in one image, where there is one animation per row. The image is called pacman.png.
We will use the following Import Settings for it:
Slicing the Pac-Man Sprite It's important to set the Sprite Mode to Multiple, which tells Unity that there is more than one Pac-Man in our Sprite. Let's open the Sprite Editor by clicking the button:
Now we can tell Unity where each Pac-Man animation slice is located in our Sprite. We will select Slice and then slice it as 16 x 16 Grid and press the Slice button afterwards:
Once the Sprite was sliced, we can close the Sprite Editor again. If Unity asks us about Unapplied Import Settings then we will click on Apply. As a result we now have 12 slices under our Pac-Man Sprite in theProject Area:
Creating the Pac-Man Animations Okay so now that we have the animation slices, we can create our 4 animations from it. As a reminder, here are the animations that we will need: ? right (Slice 0, 1 and 2) ? left (Slice 3, 4 and 5) ? up (Slice 6, 7 and 8) ? down (Slice 9, 10 and 11)
Let's create the right animation. We will begin by selecting the first three slices in the Project Area:
And then dragging them into the Scene:
Now whenever we drag several slices into the Scene, Unity will know that we want to create an animation from them, hence why it automatically asks us where to save the animation. Let's save it as right.anim in a new PacmanAnimation folder. Unity just added a pacman_0 GameObject to the Scene and two files to the Project Area:
The first file is the animation state machine that specifies things like the animation speed and blend trees. The second one is the animation itself. We will repeat this process for the rest of the animations (Slice 3, 4, 5 for left; Slice 6, 7, 8 for up and Slice 9, 10, 11 for down). Here is what our Hierarchy looks like afterwards:
Cleaning up after Unity Unity created one GameObject for each animation, but we only need the first one as we will see soon. Let's select the other 3 and then right click and delete them:
A similar thing happened in our Project Area. We now have 4 animations and 4 animation state machines:
Again we only need one animation state machine, so let's delete the other three:
The Pac-Man Animation State Machine Right now we have 4 animation files, but Unity doesn't know when to play which animation yet. The solution to our problem is part of Unity's unbelievably powerful Mecanim animation system. We will need a animation state machine that has 4 states: ? right ? left ? up ? down We will also add Transitions so Unity knows when to switch from one animation state to another. Note: Unity will play the right animation over and over again while in right state. It will use Transitions to know when to switch to another state. Unity does all of that automatically, all we have to do is notify it about Pac-Man's movement direction from within a Script later on. Okay so let's double click the pacman_0 animation state machine file in our Project Area:
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- unity pacman weebly
- unity and augmented reality scottylabs
- learning 2d game development with unity
- the car tutorial part 3 creating a racing game for unity
- so now we ve got a visual representation of the track and
- chapter 1 movement
- unity c cheat sheet and quick reference
- scripting in unity3d vers 3 4
- unity scripting beginner
- learn unity by creating a 3d multi level platformer game