Thursday, February 27, 2020

Unity Tutorial 5

Last week in our unity tutorials we made a kind of space invader-esque game using pizza and farm animals, which is great but this week we're looking to improve upon that. So lesson 2.4 focuses on making a couple of improvements, first of all we make the animals spawn completely randomly instead of on command to make the game somewhat challenging. We do this by writing a function in the code to mark the spawn range as random before we throw in some additional code so they spawn on a timer.

Next we needed to fix the problem of projectiles flying through the animals when they connect with eachother. Using colliders and checking the "Is Trigger" button we created an interaction between the animals and the projectiles, in the next step we added code to turn that interaction into the deletion of the animal. Finally we use code to trigger a pop-up game over screen should an animal make it past the player, and with that our space invader/farm animal game is functional.

We also had bit of  challenger to do for this weeks tutorials, this was pretty much to make with the same concept as the one we've been working on, but with a different arrangement, this mainly consisted of reusing what we had just learned but it was cool to see how we can make different looking games using the same mechanics.

"Fetch Game"
Source Unity

Thursday, February 20, 2020

Unity Tutorial 4

So for this Unity tutorial we took a look at a couple of different things, in the first tutorial (2.1) we looked at some basic movement functions as well as how to prohibit the player from moving to a certain area, such as the end of the map. This is done with something called an "if" factor, that for example tells the game to move a character to the right "if" they step too far to the left. I found this pretty cool since this kind of concept is used all the times in games, so learning about it was pretty interesting.

In tutorial (2.2) we looked at how to launch projectiles, in this case food, at animals. This is done by writing script that makes the object go forwards, by using prefabs we can make that motion occur whenever the player presses a certain button, in this case the spacebar, a pretty cool mechanic with plenty of uses. We also looked at how to create boundaries on the edge of the map, which deletes/removes any objects that go past them and leave the map.

In the final tutorial (2.3) we pretty much spawned animals by pressing a button and made them walk around. All of this was done with random values so the animals spawned randomly at different points in the map. This was done similarly to what we did in the previous tutorial. We also messed with the camera a bit and flipped between isometric view and perspective view. When complete the final version is pretty much space invaders but you have random animals trying to kill you, unique stuff.

Source Unity