Using PlayMaker to create a game, and exporting it to STYLY -6-

The goal for this article series is to use PlayMaker in Unity to create a FPS shooting game, and export it to the STYLY editor.

There are 7 articles for this series, so if you roughly look through the series first, I think you will get the general flow of the tutorial. In this article, we will learn how to setup the music controller and the teleportation controller.

[9] Setting up the Music Controller

To add music to the game scene, first create an empty game object named “musicController”, and give it a starting state called “Play Music”.

Open the MusicController Inspector tab, and add an Audio Source component to musicController. Drag and drop the “Boss Fight” track from the myAudio folder to the Audio Clip field, check Play on Awake and Loop, so that the music track starts as the game starts, and loops until the game ends.

Next, lets add sound effects to the enemy and bullets.

Click the Enemy prefab, and add an Audio Source component from the Inspector window. Click the little round button located on the right of the AudioClip field, and select the “mai_free_08_damage” audio track. Then, uncheck Play on Awake.

Select the Enemy FSM, and click the Dead state. Add an Audio Play action directly after the Set Animator Bool actions. Make sure the settings matches that of the next image.

Next, we will add sound effects to the gun. Add an Audio Source component to the gunController_R, and drag and drop “shot_hand_gun” audio clip. Then, uncheck Play on Awake.

Select the Spawning Bullet state in the FSM of gunController_R, and as in the image below, add an Audio Play action.

Next, I will explain how to setup the teleportation settings for the user. In STYLY, players can teleport on the surface of objects with collider.

[10] Setting up the teleportation controller

In STYLY, there is a flat collider that covers all the ground area.

But, we want the user to just be able to teleport in the arena, and not over the borders. We also want to set the bullets to fall off the stage. So, we need to remove the default floor collider. In order to achieve this, we need to create a create an empty Game Object in the Scene Hierarchy, and name it “teleportController”.

Create a FSM, and add a new starting state called Destroy Plane. Add two actions to this state. The first one should be a Find Game Object action, which searches for a object named “plane”, and stores it in a variable called plane. The second one should be a Destroy Object, which deletes the plane variable.

In the next article, lets build up the stage.

[Related Articles]
Using PlayMaker to create a game, and exporting it to STYLY -1-

Using PlayMaker to create a game, and exporting it to STYLY -3-

Using PlayMaker to create a game, and exporting it to STYLY -4-

Using PlayMaker to create a game, and exporting it to STYLY -5-

Using PlayMaker to create a game, and exporting it to STYLY -6-

Using PlayMaker to create a game, and exporting it to STYLY -7-