top of page

CG Lab 2

  • yasobel
  • 27 sept. 2020
  • 2 min de lecture

Dernière mise à jour : 3 oct. 2020

Adding more features to the 3D Platformer game.



First I noticed that my player teleports back to the beginning of the platform when the cylinder obstacle falls. To solve this problem, I added a tag to the player as well as a condition in my script as follows :

ree

Next, it was time to add UI and Sound to the game. UI is used to add a layer that is always visible to give information to the player (score or health for example) or to add menus.

However, UI is to avoid when creatin VR and AR games.

When adding a UI object such as a text for example, 2 objects appear, Canvas and EventSystem. Canvas represents the object where UI is drawn and EventSystem is what makes the UI interactable.

ree

I used UI to add a title and a victory text to the game. There was nothing to do about the title text apart from choosing the position, size, color etc.

ree

As for the victory text, I wanted something that would be displayed when the player reaches the finish line.

To do so, I started by modifying the old finish line to make it more practical by placing a marking on the platform. When the player walks through it, its color changes to green and a victory text should appear afterwards.

As for displaying the text, I started by creating an empty object named EndZone and adding a trigger collider. Then, I coded the following script to make the text visible only when the player enters in collision with the EndZone object.

ree

We obtain the following result:

ree

After that, I added some sound that is played on awake and is on a loop using UI.

ree

I noticed that the yellow part of the game was hard, so I added a help icon to make it easier in case the player wanted to.So, I wanted to make the yellow cylinders easier to jump on.

ree

As always, we add an empty object as a trigger and whenever the player collides with it, the surface of the cylinders becomes bigger.

ree

In DeathWall, I reset the original cylinders when the player dies.

ree

Another one of the problems that I have encountered is the fact that the cylinder obstacle doesn’t go back to its original position when the player respawns. So, I added these lines in the DeathWall script to reposition the cylinder.

ree

ree



I also noticed that when the player uses the help icon, the obstacle at the beginning gets destroyed, so I removed the “else” part in the OnCollisionEnter function in the DeathWall script and the problem was resolved.


But one problem remains. After animating a platform, whether it's a rotation or translation, the player doesn't move with it and I still didn't find a solution.

Posts récents

Voir tout

Commentaires


bottom of page