Reader small image

You're reading from  Hands-On Game Development without Coding

Product typeBook
Published inNov 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781789538335
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Lucas Bertolini
Lucas Bertolini
author image
Lucas Bertolini

Lucas Bertolini has 10+ years' experience as a video game software developer. He has worked on three major projects: for Pollux Ltd. (Hong Kong) as a game developer and designer; for Schell Games (Pittsburgh, US) where he moved and worked as a developer until the project was completed; and for Globant as a developer. He has worked in technical education for 5+ years and has taught a variety of programming courses. He is the cofounder of NGA and Bytenarchy Studios, both digital services development companies that use Unity as their main technology. Lucas has written Hands-On Game Development without Coding, available from Packt.
Read more about Lucas Bertolini

Right arrow

Playing with Visual and Sound Effects

In the last few chapters, we have been going through the different types of interactable objects, and have also looked at the level creator and the player character. We now understand a large portion of our gameplay elements.

However, although many of the interactable objects have a few visual or sound effects, we might feel the need to use these effects on other occasions.

In this chapter, we will focus on giving life to the environment. We will learn how to create physical, visual, and auditory responses and insert them into the game so that the world reacts to our movements and actions.

As we read in Chapter 1, Game Design – Introduction, these details are vital in getting the maximum attention of the players, making them feel as if they are inside an immersive world.

The following topics will be covered in this chapter:

  • Visual...

Visual effects

First of all, we need to know that most of the visual effects (VFX) in Unity are made with particle systems, native particle managers that allow the user to create different types of VFX.

If you want to learn more about particle systems, we suggest that you read the information at https://docs.unity3d.com/ScriptReference/ParticleSystem.html.

There are different built-in particle systems in the Unity 2D Game Kit, and we can use them without any difficulties. We can find them by going to Assets | 2D/3D GameKit | Prefabs and opening the VFX folder. Once we get to the end of this path, we will find that there are different folders that have been created to organize the different particle systems, as shown in the following screenshot:

Each of these particles have different purposes, such as the following:

  • Reaction to enemy attacks or deaths
  • Reaction to footsteps or...

Sound effects

Another thing that we may be looking forward to setting up is the sound effects in our level. There are many predefined sound effect in the prefabs and objects around the level, but we may want to use different types of SFX in other situations, and that's alright. In order to do this, we need to do the following:

  1. We need to import those sound effects to our project.
  2. In order to create an example, we will create a moving plant SFX that will be triggered whenever we walk by a plant, giving the players the feeling that they are walking through foliage.
  1. Once we import the audio file to the assets, we will head to the object we want the audio to be triggered from. In this case, we will select LowerPlants3_19 and add an Audio Source component, as shown in the following screenshot:
  1. As we have seen before, we will have to drag and drop the audio file into the...

Physics

Besides the visual and sound effects, we also want to interact physically with our environment. This is the reason why we are going to learn how to use the interactables object, which can be dynamically moved around the map.

2D Game Kit

We are now going to add a pushable box to our level, which can be used for the following purposes:

  • As a floating platform:
  • To maintain the pressure on a pressure pad:
  • As pushable boxes for puzzles:
  • As an environmental weapon that can be used against enemies:

In order to do this, we have to head to 2DAssets | Prefabs | Interactables and add the pushable box. This box has the Pushable (Script), which will allows us to move the box from one place to another.

It will also automatically...

Summary

In this chapter, we have learned how to create a better feeling of the environment by adding different reactions for the world to exhibit when the player character interacts with it.

Visual effects were created by using different particle systems, which we can trigger from different events or have them playing in the environment in a constant loop.

The same applies to the sound effects. We learned how to use the Audio Source by triggering different clips as reactions to events. Actually, the same events that activate the visual effects can be the ones that activate the sound effects.

As well as this, we learned that physical reactions can be added by inserting Pushable components or physics materials, giving us the ability to move boxes from one place to another and create different types of friction and bouncing properties. We can use these properties for different gameplay...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Game Development without Coding
Published in: Nov 2018Publisher: PacktISBN-13: 9781789538335
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Lucas Bertolini

Lucas Bertolini has 10+ years' experience as a video game software developer. He has worked on three major projects: for Pollux Ltd. (Hong Kong) as a game developer and designer; for Schell Games (Pittsburgh, US) where he moved and worked as a developer until the project was completed; and for Globant as a developer. He has worked in technical education for 5+ years and has taught a variety of programming courses. He is the cofounder of NGA and Bytenarchy Studios, both digital services development companies that use Unity as their main technology. Lucas has written Hands-On Game Development without Coding, available from Packt.
Read more about Lucas Bertolini