Main Menu Customization

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Zeekee
Regular
Posts: 61
Joined: Wed Jul 23, 2014 10:17 pm
Projects: No One But You, The Anomaly
Organization: Annexe Interactive
Skype: ytmnd111
Soundcloud: zomgaarh
Location: USAF Academy, CO
Contact:

Main Menu Customization

#1 Post by Zeekee » Wed Jul 23, 2014 10:33 pm

Hello, everyone!

Although I've been using Java and C++ for a long time, Ren'Py is fairly new to me. I've spend countless hours reading through forums and threads trying to absorb all the information as I can, but I'm still having trouble in one particular area: implementing imagemaps, particularly in the main menu. Right now, I have a background image for my main menu that I've already set to mm_root, but I can't figure out how to use my pre-made idle and hover buttons on the main menu screen. Everything I try returns an error.

In reference to this thread, I made the code below:
http://lemmasoft.renai.us/forums/viewtopic.php?p=127273

Code: Select all

    # The main menu buttons.
    imagemap:
        idle "tstart_idle.png"
        hover "tstart_hover.png"
        
        hotspot (31,555,119,34) action Start()
Is this even the right method? If it is, what am I doing wrong?

Also, in the code I referenced from the aforementioned thread, the imagemap is coded as follows:

Code: Select all

screen navigation:

    # The background of the game menu.
    window:
        style "gm_root"

    # The various buttons.
    imagemap:
        ground "menu/navigation_ground.png"
        idle "menu/navigation_idle.png"
        hover "menu/navigation_selected.png"
        selected_idle "menu/navigation_selected.png"
        selected_hover "menu/navigation_selected_hover.png"
        
        hotspot (31,555,119,34) action Return()
        hotspot (155,555,119,34) action ShowMenu("save")
        hotspot (279,555,119,34) action ShowMenu("load")
        hotspot (403,555,119,34) action ShowMenu("preferences")
        hotspot (527,555,119,34) action MainMenu()
        hotspot (651,555,119,34) action Quit()
If this is the right method for using an imagemap, how do I set different images for different buttons. By looking at it, my understanding is that if any of the hotspots are hovered over, it will yield the same image.

Thanks in advance, and sorry for such a noob question!

User avatar
Kaen
Regular
Posts: 147
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

Re: Main Menu Customization

#2 Post by Kaen » Wed Jul 23, 2014 11:26 pm

I really suggest you to study screen language to implement it.

Imagemaps are not the best option compared to imagebuttons.

Here is an example of a main menu using imagebuttons:

Code: Select all

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    imagebutton auto "start_%s.png" xpos 893 ypos 287 action Start()
    imagebutton auto "options_%s.png" xpos 833 ypos 544 action ShowMenu("preferences")
    imagebutton auto "quit_%s.png" xpos 810 ypos 631 action Quit(confirm=False)

User avatar
Zeekee
Regular
Posts: 61
Joined: Wed Jul 23, 2014 10:17 pm
Projects: No One But You, The Anomaly
Organization: Annexe Interactive
Skype: ytmnd111
Soundcloud: zomgaarh
Location: USAF Academy, CO
Contact:

Re: Main Menu Customization

#3 Post by Zeekee » Thu Jul 24, 2014 2:57 am

Kaen,

I went back through the FAQ and found the section relating to imagebuttons. I don't know how I could have missed this, but thanks a bunch! It's much appreciated.

Post Reply

Who is online

Users browsing this forum: deltadidirac, Google [Bot]