Wanted to change the textbutton to an image of a phone that changes screen color and shows the number of new mail when a message is received. I'm sure this isn't the
best way to do this, but for those wanting to do similar here's how to (images included):
Code: Select all
screen my_valuee:
text "[v] New" xpos 0.2 ypos 0.2
screen mailbox_overlay:
if new_messages > 0:
imagemap:
xalign 1.0 yalign 0.0
ground "phone_new.png"
hotspot (0,1,116,56) action Show("mailbox"):
use my_valuee(v=new_messages)
else:
imagemap:
xalign 1.0 yalign 0.0
ground "phone_idle.png"
hotspot (0,1,116,57) action Show("mailbox")
# old code with the hbox for reference sake
#hbox:
# xalign 1.0 yalign 0.0
# if new_messages > 0:
# textbutton "Mailbox ([new_messages] New)" action Show("mailbox")
# else:
# textbutton "Mailbox" action Show("mailbox")
Basically, the original code uses Ren'Py's "textbutton" function. I swapped that out with an imagemap and hotspots, then assigned my_valuee to be [v] (the given variable value, in this case
new_messages) followed by the word "New."
Here's the phone image files I edited up.
- The image for when there are no new messages
- phone_idle.png (5.5 KiB) Viewed 5217 times
- The image for when there are more than 0 new messages.
- phone_new.png (4.93 KiB) Viewed 5217 times
It ends up sorta like this:
- What it looks like in a basic scene set up (new message)
As for this:
Ryu-Kun wrote:
All right man, this is a really cool feature! I can imagine how long it would've took to code all of this!
Now here's my question!
Is it possible to change the Menu with a image file?
Looking at "Message.rpy" I see how to change it, but you have to manually assign everything in align with the X and Y axis! What I want it to have the same screen, but on a phone, or something similar to that. I know you can do it with the menu in "Screens.rpy"!
(Basically, just put the messages on a phone, like this one:
I was wanting to do the same thing for my game. I'm going to be looking into it but it'd still be awesome if anyone else already has a solution.