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

Object Behaviors - Adding Logic to Objects

So far, we have learned how to create our base level, with its visuals and boundaries, as well as some static detail objects that will enrich it. But up to now, the only interaction we have had with the environment that we just created was walking over it or colliding with its limits, and of course we want to achieve much more than that.

This chapter focuses on different object behavior that we will add to our objects, so that, once finished, we will have animated objects, objects that can kill us, and objects that collide with us, among other behaviors that will give these objects the ability to interact with us.

When we finish this chapter, we will run the first play test of our game. We have been testing from time to time, but in this case, we will make a full test, in order to be sure that every object is behaving as it should.

The...

2D Game Kit

We will keep on working on our Level 0 example we created and developed in the previous chapter, so we are going to read the following sections, we will cover the basics of collision, adding components, and moving objects. Let's go.

Collision detection

At the end of Chapter 4, Getting Started - Object Placement, we added static objects, but I guess many of us started wondering how can we make these objects interact with the player.

In order to do this, we have to start by adding collision to the object we want to interact with; whatever interactions we are looking for, the collision must always be a component of the object. As we read before, the components in charge of the collision are colliders, which...

3D Game Kit

Going on with our work, we will keep on adding things to the Level 0 example we created and developed in previous chapters. We will learn the basics of collision, adding components and moving objects, and with these, create a better level. Let's go.

Moving platforms

Adding moving platforms is much simpler than we think, because 3D Game Kit has prepared prefabs for us. A moving platform is an object that follows a waypoint system in order to move. It can do this in multiple ways, moving in the following paths:

  • One time movement
  • Cyclic
  • Repetitive back and forth

Now, let's start adding some challenges to our game. Try to create an impossible jump between the static platform and the terrain. If I don...

Summary

This is it, the moment when we can work on our own for several hours, creating the basis of our levels, and adding moving platforms and damaging static objects. This is one of the main steps of creating a video game.

We have gone through several topics, which led us to be able to create interesting levels with moving platforms that will take us from one place to the other. This will lead us to create our own puzzles and challenges inside the game.

Also, adding objects that can compromise the player's life is a great addition to our knowledge, and to our video game.

All of this would have been impossible to accomplish if we hadn't learned what a collision is and how we can use its components.

The ability to create prefabs that we will keep on using from level to level is a great tool for making level building easier.

Everything led us to being able to run our...

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