Properly using imagemaps in game

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
Rainvillain
Regular
Posts: 76
Joined: Thu Mar 05, 2015 11:27 am
Contact:

Properly using imagemaps in game

#1 Post by Rainvillain »

Hi,

I want to be able to navigate an environment (background image) by clicking on a specific area, which would then lead to a different scene.

I followed the Ren'Py handbook's various tutorials on making an imagemap for my main menu, but I can't seem to figure out how to make a simple imagemap for general navigation outside of the main menu.

I would be really grateful if someone could walk me through something basic like say, having maybe three boxes on screen, where, each one leads to a different scene. :)

(also, I should state that if there is an alternative to imagemap for such a function then I'm all ears for that as well!)

philat
Eileen-Class Veteran
Posts: 1913
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Properly using imagemaps in game

#2 Post by philat »


User avatar
Rainvillain
Regular
Posts: 76
Joined: Thu Mar 05, 2015 11:27 am
Contact:

Re: Properly using imagemaps in game

#3 Post by Rainvillain »

Thanks for the link! I've been trying to parse it for the passed week with little luck. It seems a bit beyond me and also far beyond the scope of what I'm trying to do (I don't need an inventory).

Basically, I'm just trying to implement an imagemap like thishttp://renpyhandbook.tumblr.com/post/89 ... -main-menu , where clicking on an element would jump you to a specific label/scene.
Essentially, a variation on this code:

Code: Select all

imagemap:
        ground "GUI/mm/mm_ground.png"
        idle "GUI/mm/mm_idle.png"
        hover "GUI/mm/mm_hover.png"
        
        alpha False
        # This is so that everything transparent is invisible to the cursor. 
       
        hotspot (693, 149, 92, 36) action Start()
        hotspot (697, 189, 86, 35) action ShowMenu("load")
        hotspot (605, 225, 179, 35) action ShowMenu("preferences")
        hotspot (686, 261, 97, 33) action ShowMenu("bonus")
        hotspot (703, 296, 79, 36) action Help()
        hotspot (711, 337, 74, 37) action Quit(confirm=False)
except I don't know how exactly to call upon it within the main game?
Let's say my game has three short scenes of people talking to each other. I want to have an imagemap in game that let's me choose which of the scenes to play. I'm sure there's an easy solution to this but my inexperience is getting the best of me... =/

philat
Eileen-Class Veteran
Posts: 1913
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Properly using imagemaps in game

#4 Post by philat »

Well, the reason I linked the cookbook recipe is because I thought you wanted a point and click navigation system, but at this point it sounds more like you're using the imagemap as a slightly prettier choice menu, in which case, really all you need is the Jump() action to jump to another label.

User avatar
Rainvillain
Regular
Posts: 76
Joined: Thu Mar 05, 2015 11:27 am
Contact:

Re: Properly using imagemaps in game

#5 Post by Rainvillain »

Hi philat, thanks for the quick reply!
Yeah, I suppose I'm using imagemap maps as glorified dialogue choices. It's actually a story that takes place on a ship and by clicking on a part of the ship you would jump to the specific scene that happens there.

My main question is where and how exactly do I place an imagemap in game? All the help files I've seen involve creating one in the screens.rpy... but as far as placing one within an existing scene..?

User avatar
orz
Regular
Posts: 126
Joined: Tue Apr 21, 2015 10:19 pm
Contact:

Re: Properly using imagemaps in game

#6 Post by orz »

Put it in a screen and call it from that.

Here's something really barebones:

Code: Select all

label start:
    call screen myimagemap
    return

label otherlabel:
    "Congrats, it worked."
    return

screen myimagemap:
    imagemap:
        ground "logo.png"
        hotspot (0, 0, 200, 307) action Jump("otherlabel")


User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Properly using imagemaps in game

#8 Post by Donmai »

You could simply look at the 'User Interaction' chapter of the Ren'Py tutorial game. The example script you were after is in the label 'screen demo_imagemap' of the 'demo_ui.rpy' file.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

nhguy03276
Regular
Posts: 41
Joined: Thu Jan 29, 2015 12:48 pm
Contact:

Re: Properly using imagemaps in game

#9 Post by nhguy03276 »

As your primary question has already been answered, I just want to mention if you haven't already committed yourself to imagemaps, you might want to consider imagebuttons.

I was in a similar situation as you in wanting a click based exploration of my world using imagemaps. It was mostly working, but had the idea to add simple animation. for my example, you're in a bar, you see a guy dancing on the other side of the room. The dancer is actually animated using ATL code. You click on him to get closer and interact with him, while he is still dancing. I wasn't able to get it to work with imagemaps, although I still think it is possible, however when I asked about it here, Someone suggested image buttons instead. It worked great, and actually cuts the amount of graphic work greatly. additional advantages include, if you change an element of your background, and only need to move one button, you can.. no need to redraw the imap. one button can be used for all button clicks, or if you want more, as compared to imaps where you'll need to day each map for each scene. There are other advantages too, but for now I'll just leave you the demo link that convinced me the Ibuttons were better than Imaps.


See a tutorial here: http://lemmasoft.renai.us/forums/viewto ... 51&t=22565

It's worth taking a look at.

User avatar
Rainvillain
Regular
Posts: 76
Joined: Thu Mar 05, 2015 11:27 am
Contact:

Re: Properly using imagemaps in game

#10 Post by Rainvillain »

^Thanks for the tips. I'll check out both ressources! (sorry I didn't reply sooner, I should really set these forums to send me an email when there's a reply in my thread) :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]