Game Interface Help
Posted: Sat Dec 14, 2019 12:23 pm
I'm relatively new to Ren'py. I'm trying to mess around and learn various things. I noticed that some games will have icons that you can click on the screen such as a map or a cellphone. I'm trying to replicate this process but it seems I'm in over my head. I'm able to program an "interface" button which takes me to the mapscreen and I have 3 location buttons. However when I call the location in my script it quickly flashes the location and then goes back to the main menu. I was curious as to how I could something like click "home" which will take me to the home location, Then I could click the interface/map button and go back to the map, once at the map I can click a new location like "school" and basically repeat this process as many times as I want without going back to the title screen. I tried adding a pause statement but it just made it so I had to double click my icons. I put the code below to try and help figure it out. Any help is super appreciated!
Script
MapScreen
Screen code /interface button
Thanks again for any help!
Script
Code: Select all
image Home = im.Scale("home.png", 1280, 720)
image Park = im.Scale("park.png", 1280, 720)
image School = im.Scale("school.png", 1280, 720)
default Location = "Home"
label start:
#$ GameRunning = True
#while GameRunning:
#menu:
#"Map":
#$ Location = renpy.call_screen("MapScreen", _layer="screens")
if renpy.has_image(Location.lower(), exact = True):
scene expression Location
return
Code: Select all
screen MapScreen():
frame:
xalign 0.0
yalign 0.0
xsize 1280
ysize 720
background im.Scale("map.png", 1280, 720)
for q in Places:
if q.IsActive:
imagebutton:
xpos q.x
ypos q.y
hover q.havatar
idle q.avatar
action Return(q.name)
Code: Select all
screen interface_menu():
zorder 100
if interface_menu:
hbox:
style_prefix "interface"
xalign 0
yalign 0
imagebutton:
xpos 20
ypos 20
hover "mhover"
idle "mmm"
action Show ("MapScreen", _layer="screens")
init python:
config.overlay_screens.append("interface_menu")
default interface_menu = True
screen quick_menu():