The Lonely Programmer
|
Leonard was still sick today and i haven’t heard from Oliver all day so I’ve been working alone. In the morning i went to to the classroom early even though i knew the class wasn’t until the afternoon(totally) and worked on the collision. I was writhing the logical parts needed to fill up the code template Leonard found during the weekend but never managed to finish. The parts that take the player’s position plus/minus height/2 and compares it to the other object and returns an integer depending on the result. This integer is then used to block the player from going in a certain direction. All of this is located in the player object’s update function and is sort of specific but should be adjustable for collision with guards at a later stage. After the class i realized i still had no working way to distinguish the hiding objects from the rest(it should have worked!) of them and i ended up pausing and moving on to resetting the game when a guard collides with the player. I got it working but in a “pretty” way where i let the Level class save every guard into a vector and then call the vector from the Engine. Both of these could have been solved way easier if they were all drawn with the Level as then i wold have been able to use a method in the gameobject class for getting the name of the object. |