Right now everybody is talking about Zelda: Tears of the Kingdom! I’ve been seeing advertisements for it in shopping centres and train stations, my friends are playing it, YouTubers are playing it, streamers are playing it, my dog is probably playing it when I’m not looking. I can’t play it right now, but I definitely will eventually because Breath of the Wild (the prequel to Tears of the Kingdom) was so mind blowing.

One of the many cool things about Breath of the Wild is that it lets you take photos in the game. My photo album consisted of sunset photos, funny animals and recipes.

Whenever I do escape rooms with my family, it always involves someone shouting a password from different room while another person frantically keys it in. Little Ghosthunter is kind of like an escape room, except that it is single player. You can’t exactly shout passwords to yourself from another room, so I decided to give the player a camera!

Let’s-a-Go

There has been a button under my camera icon for a while that hasn’t been doing anything. I made an image of a viewfinder and programmed the button to spawn it in the middle of the screen.

Ok, looks good! I made the viewfinder move around by controlling it with the arrow keys. Then I found the positions of the screen edges and clamped the viewfinder’s position to them so it couldn’t go off the screen.

Then, I made the viewfinder resizable by pressing the shift key + the up and down arrow keys.

Let’s get the camera working, shall we? I made it so that pressing submit saves the view of the viewfinder as an image in the game’s files. The camera’s gallery, which I had set up previously, adds that image to the next empty slot. Finally, I added a camera flash animation that is triggered when a photo is taken.

And we are done!

We Are Not Done!

Things to do next:

  • I will be adding keyboard prompts in the corner that tell you how to control the camera.
  • I will jazz up the gallery GUI.
  • I will do something to make the viewfinder more obvious.
  • Saving the photo causes about two seconds of lag because it takes up so much processing power. That’s understandable, but I’ll have to do something about that.

With how beefy the code it, it’s hard to tell what even is causing the lag.

6 thoughts on “Making a Camera

Leave a Reply

Your email address will not be published. Required fields are marked *