Programming

This week, our class began our Game Jam Assessment. The task for this was to make our own 2D platformer from scratch. In our temporary accounts, we were provided with some premade assets for us to use, this was to save time and allow us to focus on writing the code. Since it was an open book assessment, we were allowed all of our notes with us, which was very helpful as i find it difficult to remember code.

According to the list, the core features of what we had to include were:

Obstacles in the way of the player

At least 3 moving guards

If the player hits an enemy/bullet the game should restart

If the guard spots the player, it should stop and fire at them

When the player moves out of sight, the guard should resume movement

I successfully managed to complete all of these, however my enemy sprites do not face the direction they are moving. This troubled me a bit, since i did not remember how to do the face direction script, but in the end it did not matter because that wasn’t on the list of marking criteria. Overall i think i did quite well, considering it was my first ever games test, i was even one of the first people to finish.

Today in Ant’s lesson i continued working on my 2D game. The first thing that i did was create a system where if the player touches an enemy the level will restart. To get the code for this i watched the coding videos on the college moodle. As well as reacting to enemy collision, i also made it so that when the player reaches the goal (in this case the exit door) the collision will start the next level – i have yet to add anything to this level however.

After achieving this i decided to add projectiles to the enemies. Through a few scripts(‘autofire’, ‘projectile’), rigidbodies, and a bullet prefab, i managed to do so. The enemy chefs now throw knives, i like how the knives react to the environment – bouncing off walls/getting stuck. The level is also restarts when the player touches one of the knives.

In our coding lesson we continued with our mini project, to make our own bouncy ball in Unity. Since we will be adding the whole class’s bouncy balls together i tested to see if the physics of mine worked properly. As shown below it reacts well to other balls by bouncing away upon collision.

Today in our coding lesson i added enemies to the game, in this case they are chefs that i made. To these enemies i attached a waypoint script to give them movement, then messed around with the coordinates to make them follow a path.

After that i added box and polygon colliders to everything in the scene so that they can be bumped into. I then added code that made the player face the direction they are moving, rather than being a static image. A problem i came across was that the player’s character automatically reverted to it’s original rotation when not moving, the solution was to add “if (direction.magnitude > 0) ” to the code.

Next i will make the chefs throw knives, and i will give them a line of sight so that they only throw the knives when they see the player.

Scripts are things that contain chunks of code, which gets the game to function. When you want to edit a c# script, it should open in Monodevelop and not any other program; like Visual Studio.

Ant gave us access to a few Powerpoints, these have step by step instructions on how to do different things in Unity (like add a flashlight, etc).

Here are the Powerpoints we were given;

[insert link]

Ant let us use the Powerpoints so we could independently work on our game.

In the lesson we managed to create a room with a table, chair, door and a key (the models were premade by Ant). The scripts we added to them allowed us to: pick up the key, open the door, knock the chair over.

Another lesson

I decided to make a raycaster, which is the little white dot you see in the centre of the screen in many games. This let people who play my game pick up the key with more accuracy, without having to guess and click. I had a bit of trouble getting it to work, but Ant helped me. I think he put it into 2D mode momentarily, instead of changing the position he changed the scale of the raycaster from 100 to 5.

Later on in that lesson we were told to stop editing our games. We were given feedback sheets and we had to go around the room playing other people’s games, writing what was good about it and what could be improved upon.

There were loads of good game designs, and it gave me a fresh outlook on what i could do with my own game. One person had made a spaceship-like room with cool doors, there was a lever that when clicked an animation of it moving down woud activate. This then caused the door to open, but not normally, the door had an animation too so that the circular parts in the centre would rotate and it would slowly open.