How to add phone menu in my game?

Tinkel Studios

Member
Game Developer
May 13, 2018
248
201
Hello i want to add a mobile phone menu to my game it's just not for just texting i want to use an app in that phone, reach gallery, and info menu can someone help me?
 

Wildman Dev

Active Member
Game Developer
Dec 19, 2021
667
2,200
Assuming this is for Ren'py...

You'll want a high quality image of a phone screen, either through render or stock image, and then you want to add smaller, clickable imagebuttons that lead to your desired interactions (like texting or opening a gallery, which are just more images or text)




Those two *different* links are probably most relevant to what you're trying to do.
 
  • Like
Reactions: Tinkel Studios

Tinkel Studios

Member
Game Developer
May 13, 2018
248
201
Assuming this is for Ren'py...

You'll want a high quality image of a phone screen, either through render or stock image, and then you want to add smaller, clickable imagebuttons that lead to your desired interactions (like texting or opening a gallery, which are just more images or text)




Those two *different* links are probably most relevant to what you're trying to do.
Yeah i though i must do that <3 Thank you for help can i ask more detailed questions when i stuck?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,132
14,814
Have you tried to look at this thread, or that one, perhaps this one, and why not also that one ?

This without counting those I don't remember, because it's really not like it's a question that have never been asked, and so answered.


Edit:

This being said, there's one thing that you absolutely need to know when it come to a system like a smartphone, it's how Ren'Py handle the progression into its code.
Everything is based on "interactions", but it's not interaction between the player and the game, it correspond more to iteration of the code. Globally speaking, each time Ren'Py process a new script statement, it also create a new interaction.

This is important, because you'll be tempted to base all your system into a single screen, making the messages, by example, be added directly from the screen with something like:
Python:
init python:
    # Make the conversation advance.
    def nextMessage( convo ):
        messages.append( convo.pop( 0) )

# Future list of message to display
default messages = []

screen phone( convo ):

    # Background for the phone
    add "images/smartphone.png"

     # display all currently available messages
     # /!\ there's a /viewport/ needed here.
     for i in messages:
        text "[i]"

    # While there's still message, present a button to
    # progress into the conversation
    if convo:
        imagebutton:
            auto "reply_%s.png"
            action Function( nextMessage, convo )
     # Else present a button to close the conversation.
    else:
        imagebutton:
            auto "close_%s.png"
            action Return()

label whatever:
    call screen phone( [ list of the new messages for the current conversation ] )
    [...]
But during all the time you'll be on the screen, therefore during all the conversation, the progression will only be virtual.
This mean that if, for a reason or another, the player have to same during the conversation, the said conversation will restart from its beginning when the player will load.
It's an issue that nowadays mostly all devs know and avoid, but there's still some who still have a more or less big parts of their game subject to this issue.

To avoid this, it's preferable to design your screen for it to take its information from a label, something like:
/!\ wrote on the fly /!\
Python:
# Future list of message to display
default messages = []

screen phone():

    # Background for the phone
    add "images/smartphone.png"

     # display all currently available messages
     # /!\ there's a /viewport/ needed here.
     for i in messages:
        text "[i]"

    # Progress into the discussion, and close the discussion when it will apply.
    imagebutton:
        auto "reply_%s.png"
        action Return()

label whatever:
    # Declare the variables as local to this label. It permit to not uselessly pollute the game scope
    $ renpy.dynamic( "flag", "convo" )
    $ flag = True
    $ convo =  [ list of the new messages for the current conversation ]

    # As long as "flag" is True
    while flag:
        # Display the smartphone
        call screen phone
        # if there's still message
        if convo:
            # add them. The while loop will automatically display the screen again
           # and it will include the new message.
            $ messages.append( convo.pop( 0) )
         # Else stop the loop and continue the game.
        else:
            $ flag = False
    [...]
This create a new interaction each time a message is added to the discussion, and permit to the player to save at any time during the said discussion without being sent back to its beginning when he'll load.

Note that it's just one way to do, there's others.
 
Last edited:
  • Like
Reactions: Tinkel Studios

Tinkel Studios

Member
Game Developer
May 13, 2018
248
201
Have you tried to look at this thread, or that one, perhaps this one, and why not also that one ?

This without counting those I don't remember, because it's really not like it's a question that have never been asked, and so answered.


Edit:

This being said, there's one thing that you absolutely need to know when it come to a system like a smartphone, it's how Ren'Py handle the progression into its code.
Everything is based on "interactions", but it's not interaction between the player and the game, it correspond more to iteration of the code. Globally speaking, each time Ren'Py process a new script statement, it also create a new interaction.

This is important, because you'll be tempted to base all your system into a single screen, making the messages, by example, be added directly from the screen with something like:
Python:
init python:
    # Make the conversation advance.
    def nextMessage( convo ):
        messages.append( convo.pop( 0) )

# Future list of message to display
default messages = []

screen phone( convo ):

    # Background for the phone
    add "images/smartphone.png"

     # display all currently available messages
     # /!\ there's a /viewport/ needed here.
     for i in messages:
        text "[i]"

    # While there's still message, present a button to
    # progress into the conversation
    if convo:
        imagebutton:
            auto "reply_%s.png"
            action Function( nextMessage, convo )
     # Else present a button to close the conversation.
    else:
        imagebutton:
            auto "close_%s.png"
            action Return()

label whatever:
    call screen phone( [ list of the new messages for the current conversation ] )
    [...]
But during all the time you'll be on the screen, therefore during all the conversation, the progression will only be virtual.
This mean that if, for a reason or another, the player have to same during the conversation, the said conversation will restart from its beginning when the player will load.
It's an issue that nowadays mostly all devs know and avoid, but there's still some who still have a more or less big parts of their game subject to this issue.

To avoid this, it's preferable to design your screen for it to take its information from a label, something like:
/!\ wrote on the fly /!\
Python:
# Future list of message to display
default messages = []

screen phone():

    # Background for the phone
    add "images/smartphone.png"

     # display all currently available messages
     # /!\ there's a /viewport/ needed here.
     for i in messages:
        text "[i]"

    # Progress into the discussion, and close the discussion when it will apply.
    imagebutton:
        auto "reply_%s.png"
        action Return()

label whatever:
    # Declare the variables as local to this label. It permit to not uselessly pollute the game scope
    $ renpy.dynamic( "flag", "convo" )
    $ flag = True
    $ convo =  [ list of the new messages for the current conversation ]

    # As long as "flag" is True
    while flag:
        # Display the smartphone
        call screen phone
        # if there's still message
        if convo:
            # add them. The while loop will automatically display the screen again
           # and it will include the new message.
            $ messages.append( convo.pop( 0) )
         # Else stop the loop and continue the game.
        else:
            $ flag = False
    [...]
This create a new interaction each time a message is added to the discussion, and permit to the player to save at any time during the said discussion without being sent back to its beginning when he'll load.

Note that it's just one way to do, there's others.
TY MAN ILY