[solved] Moving around - help.

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
wildride
Newbie
Posts: 16
Joined: Wed Jan 04, 2017 8:25 am
Contact:

[solved] Moving around - help.

#1 Post by wildride »

Ok talked myself into doing a project for a special needs school and while my usual game engine of choice would be simple to do this with from a developers standpoint, I have to look primarily at the user stand point which is not ideal for young children with special needs. While they can use a computer, the engine I usually use is more text based and more complicated than "click on this button" (Rags/Adrift) they also do not really work for a 1st person perspective. Renpy looks to be ideal for what Im trying to achieve.

Essentially they are moving the school to a new site next month and these children do not deal too well with change. So here in my infinite wisdom tossed the idea out there for a virtual tour so to speak. Which could be evolved in more ways than a power point presentation (which is what the school are doing for parents) not to mention I think the kids would be able to access and understand it better if they can interact. This also allows a base to evolve it into a "welcome to the school" kinda app for new students.

For this I am going to be taking photographs of the rooms (once the building work is completed in a few weeks) to provide a 1st person like view. I understand most aspects of the project but one, which is how to link these images up into a "walkable" environment. How I was planning to go is like those 3d dungeon crawlers where you have a 1st person like view, and arrows for movement. Im hoping to be able to code in the movement, and add the images and change the arrow coordinates later.

So for example here is a layout map Ive already drawn up for planing.
Image

Start of game would be at 1. this would be an image of the outside of the building, a character introducing themselves and welcoming them. Then would show a forward arrow pointing inside. You can follow this in and then see something like:

Image

From here would be the forward arrow going to continue down the hall.
The two sides would take you to each room. (2 and 3)
Back would take you back outside or ideally keep you in the same room but turn around to face the door with the arrows being forward to outside, both sides being those rooms and back returning you to the same image again.

If going back outside it should not show the intro again, or may actually be blocked from returning there (as they cant without an adult).

Im sure this is possible to do as Ive seen it in other VN's (not sure in Renpy ones) Im just having a hard time finding how to code this in. Would this best be done with just a whole load of imagemaps or another method? If someone could point me in the right direction, or provide an example to connect the first few rooms (each will be using a different scene).
Last edited by wildride on Fri Jan 20, 2017 6:40 pm, edited 1 time in total.

User avatar
Enchant00
Regular
Posts: 136
Joined: Tue Jan 12, 2016 1:17 am
Contact:

Re: Moving around - help.

#2 Post by Enchant00 »

As you say, imagemaps would somewhat be an efficient way to tackle your problem. My honest opinion, is simply using powerpoint and having applying a hyperlink to the arrows leading to a specific slide (that slide being the necessary room). Afterwards, when you are done go to the slide show tab => set up show => then set it to kiosk mode and that will prevent the arrow key movements in the bottom screen from being pressed and instead the person would use the mouse to click on the arrows to go to a specific place.

However, you could use image maps and in that case you'll need around 15 groundimages (another 15 if your counting for hover image); then you can have 15 screens(or 1 huge screen) and under each imagemap you'll add a tag so that it would only show the screen during a room.

Code for the Scene:

Code: Select all

screen room1: 
    imagemap:
        tag hide
        ground "room1.jpg"
        hover "room1-hover.png"

        hotspot (x, y, width, height) clicked Jump("room2")
        hotspot (x, y, width, height) clicked Jump("room3")
        # add more hotpspots where necessary

screen room2:
        tag hide
        ground "room2.jpg"
        hover "room2-hover.png"

        hotspot (x, y, width, height) clicked Jump("room1")
        # add more hotpspots and screens where necessary 

Code: Select all

label start:
    # introduction part
    label room1:
        show screen room1
    label room2:
        show screen room2
## You could also use 1 screen then conditional statements; that way 15 screens can be put into a single screen, and you could hide each screen by a variable when it reaches a specific room(label) not sure maybe tag or using id would work

## You could also use buttons if you don't want to work with imagemaps. In that case you'll mostly be using conditional statements and might be more efficient because you could set a variable called room and for each count (if room=1 then jump to room1...) and for each number the variable is set to it will jump to a specific label.

Anyway, I'm still learning so their are a lot others in this site with better insights and suggestions :lol:

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Moving around - help.

#3 Post by trooper6 »

I'm at a cafe so I can't write up test code.

I'd use imagebuttons rather than image maps.
The game would have four variables: front, back, left, right.
The game would have a screen with four imagebuttons that jump you front, back, left, or right (Look up in the documentation the proper way to do this). Looking at your game concept, I might also have the screen take location information keyword variables for the four buttons if you want to have a custom location for each one. I'd also have an if statement before each button saying if there is no information for a given variable, the imagebutton doesn't show up.

Each location would be its own label with the image being the bg. Each label would start by setting the front, back, left, right variables for that label. Then it would call the screen with keyword variables saying where you want the buttons to show up.

That's it.

If I were at home I'd mock up some actual code...but I can't. However, hopefully you get the concept!
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
Taleweaver
Writing Maniac
Posts: 3428
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

Re: Moving around - help.

#4 Post by Taleweaver »

Moved to a more appropriate forum.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

wildride
Newbie
Posts: 16
Joined: Wed Jan 04, 2017 8:25 am
Contact:

Re: Moving around - help.

#5 Post by wildride »

Thanks Taleweaver for putting it in the correct area.

Ive used Enchants method which is working fine for what Im trying to do. Not using the hover or tag parts though. This does still essentially leave me needing 2 images for each location that has more than 1 exit. One with arrows that is shown when ready to move and one without when not moving.

I did spend a bit of time trying to get the imagemaps to work with arrows tacked on as separate images using show/onlayer but it wouldnt take. This wouldve saved a bit of filezise in the end, and I will look at the buttons version tomorrow. 1am here and Im going to pass out (hopefully) not slept right since new year which is affecting the ability for logical thinking.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Moving around - help.

#6 Post by Donmai »

Take some time to download and examine this game by Susan The Cat:
SusanTheCat wrote: http://lemmasoft.renai.us/forums/viewto ... 11&t=21101

The source code is included with the game for stealing learning purposes.

Susan
:wink:
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

wildride
Newbie
Posts: 16
Joined: Wed Jan 04, 2017 8:25 am
Contact:

Re: Moving around - help.

#7 Post by wildride »

The file seems corrupt, downloaded twice and both times gives me an unexpected end to file when trying to unzip.

At any rate got the following code which is working fine.

Code: Select all

screen hall1map:    
    imagemap:
        ground "hall1map.png"
        
        hotspot (540, 260, 100, 100) clicked Jump("hall2")
        hotspot (370, 330, 100, 100) clicked Jump("meetingroom")
        hotspot (765, 330, 100, 100) clicked Jump("office")
Just really gotta wait now til I have access to premises so I can photograph (next Friday), then go back and edit all the hotspot locations based on real images. Right now just been putting the skeleton together so to speak.

One thing Id like to add, though not important and simply because of navigation ease, is some mouseover tooltip to that so when I move the mouse over the location it will have some text shown. Ive only seen methods of using an additional hover image. Everything Ive tried so far is throwing back an error either at loading the project or when I actually move the mouse over it.

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Moving around - help.

#8 Post by Donmai »

wildride wrote:The file seems corrupt, downloaded twice and both times gives me an unexpected end to file when trying to unzip.
Nope, that file is okay. Sent you a PM, with another link.
Susan's code has everything you need (including tool tips) and some more.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

wildride
Newbie
Posts: 16
Joined: Wed Jan 04, 2017 8:25 am
Contact:

Re: Moving around - help.

#9 Post by wildride »

Thankyou, the file you PMed wasnt corrupted. Seems the download was being cut off before finishing from the host as the sizes are all different. 13mb first time, 16mb second attempt (link on forum). Then 28mb from your link, so I dont know what happened as on all occassions chrome says it completed the download.

Fired up the game and sure enough it does have everything I would want there, adapted the imagebutton code for bringing up the text.

Code: Select all

screen displayTextScreen:  
    tag message
    default displayText = ""
    vbox:
        xalign 0.5
        yalign 0
        frame:
            text displayText

screen hall1map:    
    imagemap:
        ground "hall1map.png"
        
        hotspot (540, 260, 100, 100) clicked Jump("hall2") hovered Show("displayTextScreen", displayText = "Continue down the hall.") unhovered Hide("displayTextScreen")
        hotspot (370, 330, 100, 100) clicked Jump("meetingroom") hovered Show("displayTextScreen", displayText = "Meeting Room.") unhovered Hide("displayTextScreen")
        hotspot (765, 330, 100, 100) clicked Jump("office") hovered Show("displayTextScreen", displayText = "Office.") unhovered Hide("displayTextScreen")
Will likely change things up again to make it imagebuttons rather than the maps as this will save having to put arrows on all the pictures individually saving on project size, but also allow better flexibility for future additions. As it stands right now its exactly as I want it to look to the user which is the main thing (well exactly to the point of needing to replace temp images with real images)

Like I said I would end up doing I did, realising it would be much faster to do once I have the images if they were just buttons that needed a few tweaks for position.

Code is:

Code: Select all

screen displayTextScreen:  
    tag message
    default displayText = ""
    vbox:
        xalign 0.5
        yalign 0
        frame:
            text displayText

screen hall1:    
    on "hide" action Hide("displayTextScreen")
    add "hall.png"
    imagebutton:
        xpos 560 ypos 240 idle "uparr.png" hover "uparr.png" clicked Jump("hall2") hovered Show("displayTextScreen", displayText = "Continue down the hall.") unhovered Hide("displayTextScreen")
    imagebutton:
        xpos 390 ypos 330 idle "leftarr.png" hover "leftarr.png" clicked Jump("meetingroom") hovered Show("displayTextScreen", displayText = "Meeting Room.") unhovered Hide("displayTextScreen")
    imagebutton:
        xpos 780 ypos 330 idle "rgtarr.png" hover "rgtarr.png" clicked Jump("office") hovered Show("displayTextScreen", displayText = "Office.") unhovered Hide("displayTextScreen")

Post Reply

Who is online

Users browsing this forum: No registered users