More than One Sprite
|
From struggling with one of the most difficult obstacles that I have encountered in programming so far, I have now finally learned how to design a formation of enemies in my video game, that can also be called upon to attack our player. Very exciting indeed, and because of this, the main design and programming of one of our enemies, which is also the main attack called upon from one of our other enemies, is finally completed, and another Scrum-goal has been reached. Let me explain a little further. For our video game, our protagonist (A giant, awesome robot) is supposed to protect the earth from attacking, flying machines. The flying machines fires tiny missiles towards our player, and the problem was that the missiles had to be in a triangle formation. This meant that I had to figure out how to program a bunch of missiles that would fly in a triangle formation. This was one of the programming issues that I had questioned what to do with for a long time, and I finally learned this week how to make such a formation through Unity.
What I fist did was that I created the individual missile. This I added as a new GameObject to Unity, where I also added the code for the health, strength and speed, as well as the sprite. I would later add six of these missiles to another GameObject, which would later be moved around and become the formation. Apparently, one can add many objects into one and the same GameObject in Unity! This formation would then be spawned from our machine enemies, and fly together to attack the player. With this format, I have now managed to create a formation of my missiles that I can call up with a code that I use from the machines attacking our player. This meant that the design of the attack of that first enemy was done, which fired the final design of our other enemy. I now have the triangle formation ready and set to be spawned whenever it is desired in the code. From this week, I have learned new mechanics that I will definitely remember for the future. These mechanical goals will also have helped me and my group to achieve one of our aesthetic goals. This is, indeed, very exciting! |
Picture above: Firs draft Design of our Missiles