Techshop

Unity Tutorial 24 - Refining the game part 1

So. We have a basic game now.

However it needs some refining.

For instance...

You get all the coins you add.

It pushes everything to the front.

There are no coins on the game at the start

There's no 'dead' area where you don't get anything back like a real game

In this section let's fix those issues.

First the easiest - It pushes everything to the front.

It's the easiest to solve, as it's a modification of the animation of the "pusher" object.

Editing Pusher animation

Selecting the 'pusher' and going to the "Animation" window. Then moving the current frame to the 1:00 mark…

The "pusher" is moved to the front at the time in the animation.

We can directly change the position.z coordinate. Checking at the time of 0:00, the position.z is 6, so a good halfway position for 1:00 would be 3, no?

Changing that and checking the animation we get…

https://drive.google.com/open?id=13T8vx0eyzBVeeNniW-qqK5TAzzPiCUOs

However, it's not really enough to be anything.

Adjusting the floor

The next thing that is relatively easy is to alter the geometry of the 'floor' object. A coin pusher generally has a raised lip at the end to make the coins pile up and stop them immediately falling out.

I'm going to hide everything but the 'floor' object to make this easier. Selecting them all and unticking the top-most checkbox in the inspector….

Disables and hides them

The current floor object is not quite fit-for-purpose. All of the faces are single faces. What we need from it is to 'sub-divide' the top face so we can manipulate it a little and create the lip we want.

With the face-tool selected, select the top-face…

Now click on "Subdivide Faces" in "ProBuilder"

It's possibly down the list somewhere or an icon.

It can be a little hard to see, but what was a single face is now 4 faces… If I select 2 alternative ones it may make it obvious

We don't really need four, just 2 long ones…

We can merge them back together… selecting two

And selecting "Merge Faces" in ProBuilder again, and do the same to the other two.

The main problem with this is that it creates vertices that aren't needed. We can remove them, but we have the shape we need now.

There are 3 vertices in the middle of the object, running along the width of it. Use the 'Vertex' tool and select all 3 of them

Now, my grid settings are set to 0.2, which is about right for this, and snap is turned on. With these 3 points selected , using the 'blue' 'Z' arrow, move those points to the right, towards what is the 'front' of the 'floor'. I end up with it about here…

Now. We need to add the lip itself. We need to move the front edge itself up. Selecting the 3 points that make the front top… (I adjusted the view slightly)

The grid was left on and using the 'Green' 'Y' arrow, I move the points up a single grid unit.

And that looks about right.

Play the game and you'll noticed coins actually get stuck now and with the slowly pusher, it's taking all the coins in the players wallet to actually get anywhere


GIT TAG 020_GameRefinements1

Unity - A simple tutorial < Unity Tutorial 23 - Scoring Linking with Events Unity Tutorial 25 - Refining the game part 2 >