Unity – Spaceship Game and Walking Sim

In Unity’s lesson this morning we got the brief of how the lesson was going to go. We’d get the first half to work on the spaceship game and polish it a little before we show it off to the rest of the class then after the break we’d get some time to work on whatever we wanted to for the presentation next week.

So I’ve had a bit of a scramble to get this up and running as it was waaaay behind where it should be…or at least I thought it was. I’m not sure I’ve mentioned thi9s before off the top of my head but in previous weeks we’ve been told about a website called Kenney.nl which has free assets for working in Unity and its here that most of the spaceship assets have been obtained. The starry background I’ve taken off Google (which as it happens is a real starry sky image from NASA but don’t ask me where in the night sky its from) and the rocky images are something that I knocked up in Photoshop one evening. They’re not amazing but they convey what I was looking for quite nicely.

And there they are in all their 20 minute Photoshop glory. So for this to happen I also inserted asteroids that move throughout space and adjusted the movement speed on them to simulate zero gravity. Ant was yet again kind enough to help me with a visual effect of the asteroids knocking into each other and spinning off in different directions. I’d already tried to do this at home thinking that it was just a matter of altering the movements or adding new ones in the Inspector panel but I wasn’t getting anywhere. It was actually a mix of adding a new line of code and then assigning an asteroid to it in the inspector.

Once this change had been made then all I had to do was apply this to the other asteroids and they’d all act like you’d expect them to when they’re hit.

For the movement speed and angle that they’d move I typed in small numbers, some in the positive side and some in the negative side, in the speed section of the Auto Movement inspector panel. I did the same to get them to rotate. I also placed a few stars on the screen and applied the Auto Rotate script to them too with a very small rotation speed to bring those to life. I also wanted them to have a purpose in the game and decided that you’d need to collect them all in order to proceed to the next level. I thought a new script would be needed for this but instead, it was an amendment to the ship’s Ship Controller script.

Ant explained that the inclusion of [] brackets tells Unity that we’re applying a list to the stars and tagging them as objects (end of the same line). The star length code beneath it tells Unity that there’s still remaining stars on screen and when there’s less than 1, (<1), obviously zero, the game can progress to the next level.

With only a short time remaining until time on this section would be up, I made a few extra levels. Being honest I didn’t think I’d get to make a second finished level let alone four but I threw them together remembering what Chris had said in the early days of the Flash lessons – that you don’t have to have a load of different assets to make something, its about how you use the assets you have that’ll save you time”.

With that in mind I began to squash, stretch and rotate both of the rock faces I’d created and made four levels using only two assets, and what’s more they don’t look too shabby! They also don’t look quite as sharp as these shrunken down screenshots make them out to be.

So there, I have a game! Very small I’ll admit but its there. There’s a timer in it too which will restart the level if the stars aren’t collected in a set time but I still need to alter it until I get the timing right, at the moment its either too much time or not enough.

I also haven’t gotten any buttons working in this either yet. I’d like to have one to start the game and a ‘Game Over’ message at the end of it but y’know, me and coding. I have a month to faff with it and go over Ant’s online tutorials so we’ll see what happens, I remain optimistic and stubborn that I will do it.

After the break it was free portfolio time and I worked a little on my walking simulator and asked for a little help with some of that coding. Since finishing my room project I’ve been able to focus my attention on bringing this up to scratch. It doesn’t have a theme to it, its more like an experiment of Unity and what I’m learning about it so it seems like a mish-mash of sorts.

At present it consist of the fairly empty starter room, a corridor, a ball room, a maze room, a gallery and a lava room. I told you it was random.

They’re all bare in their own way but like I said, its more of an experimentation and learning of modelling and lighting in Unity, this has also been done without any prior planning of what I wanted to look like too. It’s been heavily influenced by my panicking in the early weeks of the course not knowing what I was doing with any aspect of Unity but by experimenting like this I feel like I’m learning about it and how to do things in a very similar way to making the Enterprise-E in Maya.

I do quite like the gallery room although I need more work in it to finish it and there’s another room I want to add for a video I’ve managed to get playing. I searched the internet and managed to find a tutorial from Unity’s Tips & Tricks section of how to get video playing and Ant helped my by choosing when to allow that video to be played since Unity’s tutorial started it as soon as the scene was played. It now played when ‘E’ is pressed near it.

But what that video is will just have to wait until its seen in the presentation…maybe I’ll provide a link to it at a later date, we’ll see but I will say that it’s one of my favourites!

I’d like to, and I kinda wish it was more appealing than it is but this is all I’ve got for now. I’ve got a few days to polish it a little and find some textures to make it look as nice as I can but its not going to be as amazing as I think it should be since I know I can do better than this.

The next time I build something in it I intend to make a much better effort in it overall.

Search

Search for:

Text Widget

This is a text widget, which allows you to add text or HTML to your sidebar. You can use them to display text, links, images, HTML, or a combination of these. Edit them in the Widget section of the Customizer.