Planet Defender

The first game I am developing in Unity. No joke, I didn’t design or think of this idea on my own, it is a product of a tutorial I am taking on Unity. The basis of the game is you play a upright rocket that has to make it from point ‘A’ to point ‘B’ .

Currently, I have the rocket, part of the start screen ( as you can see ), and part of the terrain for the first level. The player can jet, turn, and become destroyed when it hits the ground.

At the moment, I am placing a weapons system on the rocket.

Got the missle to shoot, but it is coming out of the top side of the rocket and going straight up without any relation to the ship. of course, I want the rocket to come out of the point of the rocket and go in that direction. This is a conversation of global versus local co-ordinates. The missle is being created with the same direction as the player, so obviously the force that is added needs to be locally co-ordinated by the missle ( always Z, or whatever ).

So when using Instatiate, you specify its position and rotation, obviously this is being called from the players script so we use its own transform. This gave the shot the correct orientation through the rotation, but getting it to be in front of the ship was proving to be not as I thought it would be. I figured I could just add to the local axis of the player, but it always seemed to use the global axis, versus the local, even when I specified the local position. So I realized ( after a bit of constant going back and forth ) that some sort of math was needed to realize its position and rotation to calculate what was the “in front” location.

A simple google search showed me the constant transform.forward which than could be multiplied to make it far enough out that it woulden’t collide on creation with the player.

Now I want to make a block that blows up. I found a code tutorial that made the block disappear and be replaced by a new block that was made up of a bunch of blocks. This should be fairly easy and straight forward, but the next step would be making it to where only so many of the blocks are removed depending on the shot explosion ( aka the shields in space invaders or the ground in lemmings ).

Here we go!

Leave a Reply

Your email address will not be published. Required fields are marked *