Assessment leadup tests 2

After working some more on the game that I have been making as preparation for the upcoming exam, I have made some artwork and some more code to go with the game. Although it looks pretty basic, it is working out to be quite good so far.

all together.png

To start of I made the world that the player would be working their way through with 12 pixel walls all around purely to please my OCD and 2 specified rooms where the player will have to traverse around enemies to get through the puzzle. The first room at the top has 4 entry ways however there will be an enemy patrolling around the outside of it as well as one inside that the player will have to avoid to win the game.

This slideshow requires JavaScript.

I then worked towards making an objective. This consists of a collectible and an exit for the level. The star is quite obviously the collectible and despite it being quite a simple design I quite like how it turned out and the exit was meant to be a basic hatch idea however you can’t really tell so it just looks like a blend of colours so that could be improved on.

This slideshow requires JavaScript.

The last design I made for this was the player and the enemies which follow the same design of being a simple looking person wearing a hate where the enemies  are wearing red hats to show that they are dangerous.

I also made some code today as well…

Variables.PNG

This is the variables that I used for this script that is meant to make it so that the bullet is launched from the enemy every few seconds. The first variable finds the prefab for the projectile so it can spawned later on in the code. The other two are variables that will be used for maths later on in the code.

Shoot function.PNG

This first function is quite simple as when it is called it creates an instance of the prefab previously specified  in the same position and rotation as the object that it is being launched from.

update function.PNG

This function makes it so that every frame it is checking if the shot timer is greater than the rate of fire which will call the shoot function and reset the shot timer if it does.

else.PNG

Otherwise it will constantly be adding a factor based on time onto the shot factor which makes this a constant shooting timer that will fire about every 2 seconds.

This works together with another script that allows the projectile to move…

variables.PNG

The first of these variables looks for the rigidbody of the prefab so that it can move it across the screen. I also created some variables that can be used in calculations later on in the code.

start.PNG

When the object is created this code makes the rigidbody have a movement speed using the firepower as a multiplier to make it move at a constant speed.

update.PNG

This update function makes it so that there can’t be too many projectiles. It does this by taking the lifespan and taking a time value away from it every frame. It also checks if the lifespan is less than or equal to zero and if this is true then it removes it which makes it so that there can’t be too many of them.

projectile.gif

variables.PNG

This is a simple script as it only has one variable which makes a target for the camera to follow.

updatye.PNG

The update function only makes the position of the camera equal to the player however it is still a distance away so you can see whats happening still.

Camera movemnt.gif

Overall I am quite happy with what I have done so far and to improve further I will need to make it so that the enemies stop when they see the player and start shooting rather than them always moving and shooting. This will involve using raycasting to detect the player as well as changing the monobehaviour to be active or inactive to activate and de-activate scripts.

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s