Thursday 12 July 2012

Unity Teleport Code

This is a little piece of code i knocked up to handle respawns and various semi instance systems.

Shove it in a javascript file, hook it to a collider with the "is trigger" checkbox selected.  Change the cam to the character camera, and the destination to an empty gameobject placed where you want the character to go.  And done, your character should enter the collider, and exit at the destination point.

#pragma strict var destination : Transform; var cam : Camera; function Start () { } function Update () { } function OnTriggerEnter () { Teleport(); } function Teleport(){ cam.transform.position = destination.position; }

The system is being used for Frozen Skies.  I have been making videos on it for some time now.  Frozen Skies is a comglomerate of my better ideas, constantly refined into a winter survival game, where anything may kill you, and in some areas, you might accidentally kill yourself.

I am probably a few weeks away from doing a limited public test, before releasing it on the world as a very basic alpha.  This past week i have just been getting a few things straight, building a world on which people can play and implementing a save system coded by this guy: http://whydoidoit.com/unity-serializer-v0-2/
The save and load isn't fully implemented, and won't be for some time, but players can save their character progress and inventories, and name their saves something meaningful.

As for other features, i have a day/night system, plantable trees that then grow over time, a crafting system that takes into account the players proximity to workbench objects and their upgrade level, the players inventory and the item the player has activated.  The player can build structures, from gates and fences, to nuclear missile silos.

So, that's the lot for this week. Enjoy!

Saturday 24 March 2012

Nanite Exile

This is what boredom brings...enjoy:

--------------------------------------------

First was a human being. An outcast. Not because of what he had done, but because of what he had become. He was the one to sit in that chair when all hope had been lost. Tens of test subjects had been driven mad by that single injection, and yet it had worked for First. He suffered spasms and fits for them for an entire week as his body modified into a warrior. And how he was an exile, deemed "not human" and thus exempt from the new laws and rights of humankind.

Ten in all, Ten people lay back and accepted the injection. Ten in all exiled from Humanity, even though they had done so much for the planet. First was an armour designer, he designed personalised armour for each of them. Second specialised in flame weaponry, her armour blazed with heat in combat, to touch it was to burn. Fifth was a communications expert, now he fished in a pond in the outback. He had left a life of war behind him, satisfied to fish for eternity.


--------------------

More next time i'm bored.