Simulating "like button"/daily messages?

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
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Simulating "like button"/daily messages?

#1 Post by Nanahs »

In my game, in certain days the player will receive a message.
And I'd like to add a "like" button to it.

For example, the message would be like:

Image

And when you click in the heart, it changes to:

Image

If you click the heart again, it goes back to "Like this post".

I'm using a screen to show the text/message:

Code: Select all

screen messageday1:
    text "{color=#00ffff}TEXT HERE{/color}" size 35 xalign 0.5 ypos 200
And I made the "Like this post" "You liked this post" as images, that "toggle" when I click the heart icon.

Code: Select all

screen like_post:

    add "likedpost.png"
    
      
screen hearts_like:
    zorder 100
    imagemap: 
        ground 'heart.png'
        hover 'heart1.png'
        
        hotspot (618, 60, 79,49) ToggleScreen("like_post") 
It works. But here comes the problems.

When you leave the message's label there's the "hide screen like_post", "hide screen hearts_like", etc. Because it has to "disappear" in the other label :lol:
When you go back to your imbox (messages label), the post you "liked" will be back to normal, as if you hadn't liked it. Because it was only a "toggle screen" function.

My doubt is, is there a way I can make it "fix" if the person clicked the like/heart?

Like, even if they leave. When they go back there, it would still be "you liked this post".

Also, since the messages will change when the day is over [real time], how could I "reset" the like button? Should I put this button inside of the message screen? So when the message screen changes in the other day, the like button would also be another one and so it would be "reseted"?

Oh, this is kind of confusing, sorry :oops: :oops: :lol:

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users