Wednesday, 8 February 2012

Camera Button

A camera turn function has been integrated that allows the user to switch between one of eight different camera angles, which can be animated between, by cycling through in order. This is done by clicking an on-screen button.

Clickable Menu Integration

A menu that can be clicked, which will load a scene.

First-Person Stationary Scenes

One of several new additions is that an icon can appear when hovering over a object you can interact with.



The discovery that the camera can be animated so that stationary scenes can be made.

Monday, 6 February 2012

Grab & Shoot

This video combines three functions together - the automatic respawn (though falling through the stage isn't possible anymore), the ability to drag objects, and a firing function that shoots a white ball from the player's chest towards objects.

This function obviously isn't going to be used in the game, but its creation served to further embellish upon Matt Jonas' knowledge and understanding of coding for the Unity platform.



This project can be downloaded and run on Windows XP, Vista and 7. Download this file (7.2MB), unzip the files within, then double click on the executable file (exe) to run the game. To drag objects, click and drag when the camera is centred over the object. To fire a shot, press Control (CTRL).

To fix the bug where Left Click also fires a shot, adjust the controls for "Fire1" in the Controls section of the loader (the window that pops up before you load the game).

Grabbing Objects

Matt Jonas attempted to write some code to enable object dragging within the game, however, an example of such code already exists and can be tweaked to the developer's satisfaction. This is a video showing the implementation of this code, which allows the player to interact with and drag in-game objects.

This could be used for moving a box out of the way of a door, ripping a painting off a wall to reveal a safe, or blowing sand away to reveal a hidden message. It could also be used as a fun game mechanic that rewards players who have the initiative to look around and interact with objects.


This scene also contains the respawn function, as previously integrated.

Respawning Script for Unity

Matt Jonas wrote a Respawn script for the Unity engine so that if the player were ever to fall through the environment (unitentionally, of course), the player will instantly be respawned back at a specified origin point. This can be tailored in each scene so that the player is always returned to the correct location.

The code checks on every Update (which means every frame rendered) if the player has fallen twenty metres below origin. If they have, the game returns the player to a specified point (which can be changed in each scene). The script will also return the player's facing to the correct direction.

 

This was the first script written by Matt Jonas to familiarise himself with the Unity engine and to remind himself how to compose correct Javascript. 

Unity supports C#, Javascript and BooScript. In fact, a combination of any, so long as a file is composed in only one language. Multiple files (each composed in a single language) can be combined, even though those files may not all be written in the same language.