Unity [Session 3]

    

The sections we went through during this session were 'World Interactions - Damage Zones and Enemies', and 'Sprite Animations'. The first part of the involved adding the ability to lose health to Ruby's code, and to add things into the environment that can damage her. The first thing we added was in the form of these black and yellow spike sprites, which required their own code in order to be able to damage the player.

There were some extra adjustments we had to add to make sure this worked properly, such as making sure it would effect the player when they are inside the damage area rather than just the moment they initially touch it, adding a brief invincibility window to make sure the player wouldn't lose all of their health instantly. At this point, the amount of code in the RubyController Script was beginning to get a little difficult to keep track of, but I just about managed with it.


The next step was to add moving enemies into the environment. To start of with, our enemy sprite was given some basic properties such as a Rigidbody 2D and Box Collider. The next and most important task was to create a script which would allow us to make our enemy sprite to move around the scene. Many lines of code were required to make this operate properly, such as a timer which would occasionally change the direction our enemy was moving in. This added an element of randomness to their movements while also preventing them from getting stuck on obstacles.

The final stage of this section was to give the enemy the ability to damage the player if they both collided.


We then moved onto the Sprite Animation part of our tutorial. This required two tabs that we hadn't used before, the Animation and Animator tabs.


We first tested using these tabs on an object. The object we chose to experiment on was the metal box sprite.


Some of the things we experimented with included making it move up and down, rotate, then move around and rotate both at the same time. We then tried organising these movements into a sequence.


We went into the package files to transfer the full sprite sheets into our project files. Within the sprite sheets were contained sprites of the characters walking in different directions (to the side, up and down) and several other states. We then went about assigning these sprite the appropriate actions to make sure they showed the corresponding sprites to the directions they were moving in.


We did this with the robot first, and then repeated the process with our main character. There was a great deal of effort and many steps that had to be taken in order to get this done. There was also a few other widgets we needed to make us of, such as the Blend Tree.


The last thing we did was turn our enemy into a prefab so that we could duplicate them across the scene.


I had quite a few issues during this section of the tutorial, and I generally found it very difficult to follow along. Though I did fall behind a few times, the tutor would pause the tutorial every now and then, to go around the room and see what stage people were at and if they were having any problems. It was usually during these short intermissions where I would catch up to the right point in the tutorial and get help from the tutor if needed.




Comments