Artifact Blogpost

Image

I will be talking about an artifact I’ve worked on this week. I’ve been working on a functionality for hiding, it has been delayed by several things. At first i was starting work on the guards until i checked my phone and saw that Oliver had already started doing that so that’s two hours down the drain. Then Git stopped working and delayed me for another three hours. Eventually i was able to do actual work on it however. First i made a separate vector in the Engine for pointers to the objects the player could hide behind and sent it into the PlayerObject’s update method. This means the program won’t have to run through as many game objects every time it updates. Then i did what was depicted in the image, first of all it checks if the player is pressing the E button, after that it runs through every game object and sets the player’s position to that object’s if it’s within the range of the player. This is not yet made to support multiple hiding objects in range at once as that will only place the player at the last object in the list, but since there is no two objects the player can hide in near each other in the pre-alpha and might even not be in the final game. The image dosen\t show it but player is also prevented from moving and rotating by mouse until another button is pressed to un-hide the player. The issue i was having for a long time is also shown in the image where the i variable would be set to a very low negative number for reasons i still don\t understand. I was unable to solve this so in the end i replaced the for loop with a while loop doing the exact same thing and it works. After taking the image i also moved the check for whether the player was hiding (bool m_hiding) and moved it outside the while loop so that the loop won\t be called every time. What this does not yet do is to to play any animation for the player getting into the object, it also does not change the sprite of the object when a player is hidden inside. These things are not necessary for the pre-alpha but will be implementable at a later point.

I feel like this was sort of a weak artifact to write about but it’s what I’ve been doing.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a comment