Today I want to share something that gave me troubles not long ago.
Navigation.
Navigation was one of the first things that game me headaches while trying to make a visual novel.
So it was like I wanted to make a hallway which leads to different rooms, areas, and events but I had no idea how to use images as buttons or how to create areas on the background to trigger transitions.
Had troubles finding tutorials for that kind of thing, I asked around and some people in different forums helped me to figure it out.
Here is an example:
We have three doors in this hallway, and I also want to add the option to go back or turn around.
I will be using image buttons to solve navigation; by clicking on the doors you will be able to move to new locations.
In this case I want to use two images for image buttons, idle and hover image:
The idea is that when the player hovers the mouse over the idle image the door will light up or change into the hover image. To do so I will be using screens in Ren'Py. I'm using
call screen to bring the hallway in.
The code looks like this:
Python:
#Hallway.
screen crhw:
add "0.01a/Nav/Sch/Hw/Schw006.jpg"
imagebutton auto "0.01a/Nav/Sch/Hw/crd1_%s.png" xpos 1639 ypos 273 focus_mask True action Hide("crhw"), Show("clsr1")
imagebutton auto "0.01a/Nav/Sch/Hw/crd2_%s.png" xpos 1254 ypos 433 focus_mask True action Hide("crhw"), Show("clsr2")
#Classroom.
screen clsr1:
add "0.01a/Nav/Sch/Clr/ClsR000.jpg"
screen clsr2:
add "0.01a/Nav/Sch/Clr/ClsR004.jpg"
So the first door will lead to:
And the second door will lead to:
Two locations inside the same room.
There is also the hallway door leading further down the hall and the left corner of the screen allowing the player to turn around, I'm omitting those in this example.
The main complication with this method is to create the idle and hover images, but more so is placing it on the right spot.
xpos and ypos allow us to change the image position; the anchor point is on the upper left corner of the image.
Also make sure you specify the right image path and name to prevent errors.
Well there it is, I hope this help others. I certainly had a hard time learning it.