Okay, I spent the last few hours teaching myself exactly how to do what you wanted. I did this by looking at the cookbook and the documentation and then experimenting. I want to emphasize that before this moment I had never made an image map before and my image button experience was limited. I mention this for two reasons...1) if I can do this through trial and error and reading the documentation carefully, other people can also do it, and 2) one of the more expert people might know of a better way to do some of the things I did...but it all works.
So I have created a project that does exactly what you want. It does it in two different ways. The first with image maps, the second with image buttons.
If I were doing this for myself, I'd probably make a few changes...but this does what you want. If I had more time to mess with this, I'd probably make one big screen that held all of the elements...but I went with the quickest way I thought of.
Here is the code and I'm also attaching the project so you can play with it.
Code: Select all
# You can place the script of your game in this file.
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
image lydiaP = "images/LydiaPort.jpg"
image dianaP = "images/DianaPort.jpg"
image julietP = "images/JulietPort.jpg"
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
screen control_map():
frame:
xalign 0.5
yalign 0.7
textbutton "Gallery" action [If(renpy.get_screen("button_map"), Hide("button_map"), Show("button_map")),
If(renpy.get_screen("portrait"), Hide("portrait"), Show("portrait", who="None"))]
screen control_buttons():
frame:
xalign 0.5
yalign 0.7
textbutton "Gallery" action [If(renpy.get_screen("button_images"), Hide("button_images"), Show("button_images")),
If(renpy.get_screen("portrait"), Hide("portrait"), Show("portrait", who="None"))]
screen button_map():
imagemap:
auto "images/ButtonMap_%s.png"
hotspot (51, 41, 201, 52) action Show("portrait", who= "diana")
hotspot (51, 141, 201, 52) action Show("portrait", who="lydia")
hotspot (51, 249, 201, 52) action Show("portrait", who="juliet")
screen button_images():
vbox:
imagebutton:
auto "images/DianaB_%s.png"
xpos 50 ypos 50
focus_mask True
activate_sound 'click.wav'
action Show("portrait", who= "diana")
at butt_eff
imagebutton:
auto "images/LydiaB_%s.png"
xpos 50 ypos 100
focus_mask True
activate_sound 'click.wav'
action Show("portrait", who="lydia")
at butt_eff
imagebutton:
auto "images/JulietB_%s.png"
xpos 50 ypos 150
focus_mask True
activate_sound 'click.wav'
action Show("portrait", who="juliet")
at butt_eff
screen portrait(who):
frame:
background "#000000"
xalign 1.0
vbox:
if who == "diana":
add "dianaP"
text "Diana is the science officer."
if who == "lydia":
add "lydiaP"
text "Lydia is the security officer."
if who == "juliet":
add "julietP"
text "Juliet leads the resistence."
if who == "None":
null height 400
init -2:
transform butt_eff:
on idle:
easein 0.3 zoom 1.0
on hover:
easein 0.3 zoom 1.05
# The game starts here.
label start:
scene black
show screen control_map()
"Click on the gallery button!"
"Here we are using Image maps to show different images. Try out the image map buttons!"
"If you are done click the gallery button again to get rid of the image map."
if renpy.get_screen("control_map"):
hide screen control_map
hide screen button_map
hide screen portrait
show screen control_buttons()
"Now let's try Image buttons! Click on the gallery button!"
"Here we are using Image buttons. Try them out a bit."
"If you are done click the gallery button again to get rid of the image buttons."
if renpy.get_screen("button_images"):
hide screen button_images
hide screen portrait
hide screen control_buttons
"Okay, the game is over"
return
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978