Adding a smartphone with various functionality [WIP]

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Adding a smartphone with various functionality [WIP]

#16 Post by SundownKid »

This phone would work better with imagebuttons so you can easily add and remove functionality from the phone. Each icon should be a separate button in a grid. Throw away the imagemaps altogether, they are bad for something this modular!

Code: Select all

screen mainphonescreen:
    frame at popup:
        xalign 0.5
        add "Phone/150Phone.png"
        grid 4 4:
            imagebutton auto "phone/photo_%s.png" action ui.jumps("take_a_photo")
I think a setup like this would work, haven't tested it though.

Also, you seem to use labels to show screens when you can really just show a second screen on top and replace it by tagging it with something like "phoneui".

This:

Code: Select all

label travel_map_a:
    call hide_all_phone_screens
    show screen blank_phone_screen
    show screen travel_map_a
    "" #Need this, or bad things will happen...
    jump travel_map_a # To prevent more bad things happening.
Can be completely removed with no ill effects.

You should also align the phone bg and buttons at the center, and use a transform to make it look like it's popping up from underneath.

I managed to make a cool looking popup animation by using this transform:

Code: Select all

transform popup:
    yalign 10.0 rotate 50
    linear 0.3 yalign 0.5 rotate 0
Also, the new phone code is glitched, the last line on the imagemap should be changed to:

Code: Select all

hotspot (127, 492, 86, 42) clicked ui.jumps("hide_all_phone_screens") # Home button (Exits)
If you want, I can fix it, just give me a folder with all those placeholder icons.

You should probably just maintain a playable demo and let people copy the code from there rather than releasing it separately/in the OP.

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Adding a smartphone with various functionality [WIP]

#17 Post by TrickWithAKnife »

Thanks for the changes. I'm busy per the next couple of days, but I will try everything out.
I'm not so keen about reuploading everything whenever a change is made. Because this code is based off my own game, I basically have to remove anything I don't want to share, remove files not needed in this demonstration, text everything out, create a distributable, upload it, get a link, and add the link to this topic. It's something I want to avoid unless it's absolutely vital. At this point people could download the attached files and just copy and paste the code.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Adding a smartphone with various functionality [WIP]

#18 Post by SundownKid »

I have some free time, I will try fixing everything up. I will switch to free use icons so no one gets sued..

Looking at it right now, I feel that the grid should actually be 3x4 because 3 of the buttons are superflous. The clock should be on the phone menu bar instead of a separate screen. Mail is too similar to messages and they could probably be combined. Phone is also too similar to Contacts and could be combined as well, since any phone usage would be from a list of contacts.

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Adding a smartphone with various functionality [WIP]

#19 Post by TrickWithAKnife »

Awesome. *Puts up feet and relaxes*

Um, joking aside, if you can improve things, maybe you could make your own topic?
I mostly threw together other people's ideas anyway so I could help get the cookbook section of the forum active,
but have a bare minimum of programming knowledge. If you do want to make a topic, I would happily remove this one, unless a moderator beats me to it.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Adding a smartphone with various functionality [WIP]

#20 Post by SundownKid »

This... is somewhat harder than I thought. Anyway, here's an example of what can be done.

Code: Select all

# This creates the button to show the phone menus
screen button:
    imagebutton idle "Phone/phone smallest.png" hover "Phone/phone smaller.png" action Show('mainphonescreen') xalign 0.0 yalign 0.0
 
#*******************************************************************************#
#                                                PHONE STARTING SCREEN                                                        #
#*******************************************************************************#

# This part shows the main phone screen, and controls what happens when icons are clicked.   

transform popup:
    yalign 10.0 rotate 50 xalign 0.4
    linear 0.3 yalign 0.5 rotate 0 xalign 0.5
    
screen mainphonescreen:
    modal True
    frame at popup:
        xpadding 0 ypadding 0
        xmaximum 334 ymaximum 555
        background "Phone/300x400 phone no icons.png"
        use phoneselect
        hbox xalign 0.5 yalign 1.0:
            spacing 100
            imagebutton auto "phone/icons/1_%s.png" action Hide('phoneui', transition=dissolve) # Back button
            imagebutton auto "phone/icons/1_%s.png" action [Hide('mainphonescreen', transition=dissolve), Hide('phoneui', transition=dissolve)] # Home button (Exits)
        
screen phoneselect:
    grid 3 4 spacing 30 xalign 0.5 yalign 0.5:
        imagebutton auto "phone/icons/1_%s.png" action Show('start_map_app', transition=dissolve) # 1st icon (Map)
        et cetera...
And the map viewing app:

Code: Select all

screen start_map_app:
    tag phoneui
    side "c b r":
        xmaximum 296 ymaximum 353
        xalign 0.5 yalign 0.5
        viewport id "vp":
             draggable True
             vbox:
                 
                 imagebutton:
                     idle "Maps/mega tokyo map 3.jpg"
                     hover "Maps/mega tokyo map 3.jpg"
                     #action ui.callsinnewcontext("start_word_list") # FOR TESTING OTHER PHONE ICONS
Right now the map and other apps pop up over the selection buttons - I couldn't find a way to replace them instead, but I guess this works. It's still far better than how it was before.

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Adding a smartphone with various functionality [WIP]

#21 Post by TrickWithAKnife »

Code: Select all

# This creates the button to show the phone menus
screen button:
    imagebutton idle "Phone/phone smallest.png" hover "Phone/phone smaller.png" action Show('mainphonescreen') xalign 0.0 yalign 0.0
This code doesn't hide the small phone images when the large image appears.

I've created the icons for the phone, and copied the phone code, but keep getting a bunch of error messages, and haven't been able to alter it to get it working.

There was also a typo on a few lines with the directory names, where "phone/icons" should be "Phone/icons".
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Adding a smartphone with various functionality [WIP]

#22 Post by SundownKid »

For the imagebutton it should probably be:

Code: Select all

imagebutton auto "Phone/phone_%s.png" action Show('mainphonescreen') xalign 0.0 yalign 0.0
(Where the images are phone_idle and phone_hover)

I actually got it working with text below the buttons:

Image

Here's a sort of draggable "feed" you can use for internet/social network browsing:

Image

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Adding a smartphone with various functionality [WIP]

#23 Post by TrickWithAKnife »

What are you naming the actual icon images? Maybe I'm messing it up there.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Adding a smartphone with various functionality [WIP]

#24 Post by SundownKid »

In the code i posted they are called "1_idle" and "1_hover", etc.

You can change it in the path of the imagebutton called "1_%s".

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Adding a smartphone with various functionality [WIP]

#25 Post by TrickWithAKnife »

Thanks, that was the problem.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

User avatar
Bellalea
Newbie
Posts: 22
Joined: Sun Jun 17, 2012 6:06 pm
Location: Finland
Contact:

Re: Adding a smartphone with various functionality [WIP]

#26 Post by Bellalea »

This looks interesting, I'll be waiting for updates (:

User avatar
Destiny
Veteran
Posts: 468
Joined: Thu Jun 14, 2012 2:00 pm
Projects: Cards of Destiny, Sky Eye
Location: Germany
Contact:

Re: Adding a smartphone with various functionality [WIP]

#27 Post by Destiny »

This is definitly a interesting code :)
I will not need it now, but if I'm going to make a second game someday, I will definitly think about it.
The possibilitys are really too tempting to ignore this ^^
Image
Cards of Destiny (WIP) / Sky Eye (WIP)

holly64
Newbie
Posts: 1
Joined: Wed Aug 08, 2012 3:53 am
Contact:

Re: Adding a smartphone with various functionality [WIP]

#28 Post by holly64 »

Bellalea wrote:This looks interesting, I'll be waiting for updates (:
Do you by chance know when these updates will be coming? Would also be cool if it integrated with voip or Mobile Voip smartphone capabilities.

Thanks in advance,

Holly
Last edited by holly64 on Thu Feb 26, 2015 1:34 am, edited 2 times in total.

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Adding a smartphone with various functionality [WIP]

#29 Post by TrickWithAKnife »

Probably not for a while. My game is the main focus, and right now it doesnt require the smartphone.

Plus id like to get some phone images, so i can modify the code to match the sizes etc.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

User avatar
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

Re: Adding a smartphone with various functionality [WIP]

#30 Post by Trafagal »

Just came to visit this while looking for a Phone system. Thank you guys for the work. It is almost 10 years ago, I hope this still works.
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

Post Reply

Who is online

Users browsing this forum: Amazon [Bot]