Intro
This is a series following Cosplore3D, a raycaster game to learn 3D graphics. This project is part of 12 Months 12 Projects, a challenge I set myself.
What To Put On The Page
Before we actually start creating the settings page, we need to know what we're going to put on it, so let's make a list.
- Field Of View
- Depth Of View
- Sensitivity
- Difficulty
Implementation
g.settings = Setting{
[]*Button{
{0, screenWidth / 15 * 2, screenWidth / 5, screenHeight / 14, color.RGBA{32, 32, 32, 255}, color.White, "Menu", open_menu},
},
map[string]*TextBox{
"fov": {"90", 0, screenWidth / 15 * 3, screenWidth / 5, screenHeight / 14, color.RGBA{32, 32, 32, 255}, color.White, false},
"dov": {"30", 0, screenWidth / 15 * 4, screenWidth / 5, screenHeight / 14, color.RGBA{32, 32, 32, 255}, color.White, false},
"sen": {"90", 0, screenWidth / 15 * 5, screenWidth / 5, screenHeight / 14, color.RGBA{32, 32, 32, 255}, color.White, false},
},
}
What we've create here is a back button and a few text boxes, one for field of view, one for depth of view, and one for sensitivity. These text boxes were basically copy pasted from the level editor.
Connections
Now we need to start connecting these values. I think the best place to change FOV and DOV is when the player opens a new level, because this is when the most change is already happening, so it will be seamless.
And when I put the FOV really high here is the effect.
It looks very strange, and the enemies sometimes don't know where to be drawn, but it works.
Difficulty
For difficulty, unlike other games, where you have set intervals such as easy, medium, and hard, we're going to have anywhere from a difficulty of 1 to 1000. This means you can create an insanely easy game, or an insanely hard game, or anything in-between. Setting the difficulty to 1000 is definitely not recommended, and makes it impossible to kill anything, but it's still an interesting option to have.
Next
There is something very obvious missing from the game, and that's an ending. You kill the last boss and you're just kind of left there not knowing if it's the end. In the next post we'll have to think up of something cool to do when they finish the game, and implement it.
Top comments (0)