|
this week I worked on how the player would be transported through the room. at first we just wanted to delete the door so the player could walk freely between the rooms. This showed itself to be quite bothersome.
To explain how our game works. We’re designing a game called “Bullet_hack” wich is about a spy trying to infiltrate a compan to get information about them. You play as the spy and try to hack doors to get to the main server. You hack the doors by playing a shooter game where you destroy the enemy spawn points to progress to the other room.
  since we change scenes to initiate the hacking game deleting the door will not work since the loadscene(); function recreates everything in the scen you load. So deletion is of the table. So i decided to try to see if i can get the player to teleport between the rooms upon interaction with the door. This was a huge failure on my part. I tried using PlayerPrefs to save the players position and change it whenever a level was loaded. In hindsight, this would have caused me a metric ton of problems and work in the future since it meant that i would need to specify exactly where the player would spawn after every level.
So after a week of frutration I asked Håkan for guidance. Five minutes later the telportation was fixed. He told me that all i ned is a static string and several empty gameobjects called “Spawn_point” (with a number at the end) and tie the players position to the Spawn point and the string as a tool to specify wich spawn point to teleport the player. This worked and I still slam my head into walls or any other hard surface I find because it’s so simple and i didn’t think of it at all. In my defence i tried to find answers online, but everything i found pointed me in the direction of PlayerPrefs and, strangely, they also pointed out how bad they are for teleportation and in general. This should have been a big tip off that whatever I would potentially do with the PlayerPrefs it wouldn’t be worth the effort when there’s simpler options available. The lesson I learned this week; in the future I will try to ask the teachers if I have problems with anything instead of trying to force google to tell me.
About Tobias Holm
2016 Programming
|