Here is the basic layout of the blocks (these will be the boxes and barrels etc.) they then fall to the floor (as shown in the photo below).
Boxes have fallen to the floor, so that the player can now go over to them and interact with them.
Here is a photo of the player holding the block, the player is about to move it high and low as well as move it from left to right.
They are then able to stack the blocks, thus enabling them to form stairs.
Here is a photo of a trigger area which will load the next level of the game. This might not be necessary however I have played around with it and as shown in the photo below it changes to the new level, so this is a useful code to have just incase we need it.
This first bit of code above is the actual pick up and drop code. In this code I am using a Raycast to see if we are holding an object. Once the player has clicked the mouse button down, the object then gets parented to the camera, becomes a kinematic object. The player is only able to pick up objects which have the 'Interactive' tag assigned to them in the Unity Inspector.
The code above is for the level to load once the player is in the trigger area. This code was very simple, using the OnTriggerEnter method, once the player is in the collider with the trigger, the Application.LoadLevel(levelName); is called and the new level loads for the game.
No comments:
Post a Comment