i can have problem with imagemaps? now it work perfectly.
i'm new in renpy and python and i've to study as imagebutton works..
i've to do a focus hover also in my room sets for bed,pc,etc etc.
it's better i study for imagebutton or i can use this script?
It's better if you study up on imagebuttons since imagemaps are old stuff that is only left in ren'py because of backwards compatibility.
i'm working on imagebutton use.
i need of an arrow to come back on room screen quen i go in pc screen.
i write this for put an arrow on botton center of screen:
Code:
label pcmyroom:
scene pcmyroom
#inserire cose da fare al pc
imagebutton auto "arrow_%s.png" xalign 0.5 yalign 1.0 focus_mask True action Show("myroom")
but when i try this error say:
Code:
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/myroom.rpy", line 27: end of line expected.
imagebutton auto "arrow_%s.png" xalign 0.5 yalign 1.0 focus_mask True action Show("myroom")
Ren'Py Version: Ren'Py 7.1.0.882
Mon Sep 24 20:04:10 2018
"imagebutton" is part of the screen language, it can't be put directly into a label.
Right, as are all buttons
So yes you can't throw in a button into a label as you've figured out already, they can only be used on screens
But beware that "FULLSCREEN" imagebuttons are useless
That's how imagemaps really worked and that's why they are not used anymore. Imagebuttons are buttons that have only the portions of the image inside them that you need as a button, instead of one full screen image for idle state and one for hover state, you now have 1 background and for each button at least 1x idle (and best 1x hover too but it's not mandatory).
Ok here's an example of how an imagebutton setup "could" look like in let's say a main_menu scenario (Sorry can't show too much since it's a secret project for now) :
Now as you can see, all buttons (Load, Settings, Extras, Help, Quit) are in their idle state, except for Start which I'm hovering over with my mouse. The start button code looks like this in my case:
Code:
if main_menu and currentScreenName == "main_menu":
imagebutton auto "/gui/custom/BUTTONS/START_%s.png" action Start()
elif main_menu and not currentScreenName == "main_menu":
imagebutton auto "/gui/custom/BUTTONS/START_%s.png" at invisButtons action None
ignore the if and elif statement, it's just something I needed, well look at the imagebutton auto "image files" action
this is how you'd usually do a screen with buttons. The placement where those buttons are on the screen are handled elsewhere in my case, it's not a problem to do it like you did, each button it's own coordinates, but in the main menu case they're all next to each other so I only had to place 1 button and the others were put right next to the first
Ok and here's how the two Start buttons look like:
<- Hover
<- idle
again, this is just an example, you can do them however you want, but this is a good example of how buttons shouldn't be "full screen" if at all possible (one reason being, android can't handle full screen transparent imagebuttons and would just always click the last added button because focus_mask doesn't seem to work there...)
Alright, download the images, check their size i.e. and then get going
And when you're done with your game I'd be happy to give it a testrun
edit:
You must be registered to see the links
you can find an amazing little tutorial game on what imagebuttons can do (even showing what you can't do with imagemaps) and how they're used
As I always mention to new guys, the lemmasoft forum is the best resource for ren'py related stuff, so if you need help, try looking through the forum (use their search engine i.e. or use -> site:lemmasoft.renai.us <- on google while searching for something i.e.: renpy imagebutton site:lemmasoft.renai.us)
If you can't find it there, the problem you're looking for hasn't been solved by anyone yet. Which means, ask there (or here again but there you get help from really good programmers instead of people like me
)