Room navigation and free movement
Posted: Mon Feb 13, 2017 8:17 am
Hi, I'm working on a simple game which is also a way for me to learn coding. Recently I've decided to try to make some sort of free movement. It was challenging but I was moving slowly. However I feel like I've hit a wall and also I'm pretty sure I've got it somehow all wrong. So after a while of bashing my head against the wall I decided it would be best to ask someone who knows what he's doing.
Alright so here's how I've done it. I've made separate .rpy file for each room. Each room is basically a screen with imagemap with clickable buttons with "Jump" actions directed to labels. Now I know it's probably all wrong and messed up but so far it kinda worked. Here's a little example:
Now here are some thing I either don't understand or some problems I've stumbled upon:
-hiding stuff
Is there a way to hide everything and just show one thing? As I understand it, every time the player moves from one location to other I have to hide everything that was shown but that doesn't seems right. As I would add more and more locations, the hiding would become ridiculous. Or am I doing it completely wrong?
-minimap on top
I've also started to mess a bit with map. I've made a minimap icon but I'm not sure how to keep it on top all the time. It's an imagemap that jumps to label with map screen.
And of course my biggest and most important question is, is it a viable code or is it a complete nonsense? Oh and please try to keep it as simple as possible, I'm really a beginner. Thanks!
Alright so here's how I've done it. I've made separate .rpy file for each room. Each room is basically a screen with imagemap with clickable buttons with "Jump" actions directed to labels. Now I know it's probably all wrong and messed up but so far it kinda worked. Here's a little example:
Code: Select all
label room:
hide screen hallway
window hide
show screen bedroom
show screen minimap
$ renpy.pause(hard=True)
screen bedroom:
add "bedroom empty.png"
imagebutton auto "bedroom/pc_%s.png" xpos 905 ypos 328 focus_mask True action Jump("pc")
imagebutton auto "bedroom/window_%s.png" xpos 000 ypos 062 focus_mask True action Jump("windov")
imagebutton auto "bedroom/board_%s.png" xpos 525 ypos 142 focus_mask True action Jump("board")
imagebutton auto "bedroom/exit_%s.png" xpos 609 ypos 592 focus_mask True action Jump("upstairs")
imagebutton auto "bedroom/bed_%s.png" xpos 000 ypos 427 focus_mask True action Jump("bed")
imagebutton auto "bedroom/closet_%s.png" xpos 1061 ypos 000 focus_mask True action Jump("closet")
label bed:
hide screen bedroom
show bedroom_empty
"Oh I wish I could stay in bed forever...."
jump room
-hiding stuff
Is there a way to hide everything and just show one thing? As I understand it, every time the player moves from one location to other I have to hide everything that was shown but that doesn't seems right. As I would add more and more locations, the hiding would become ridiculous. Or am I doing it completely wrong?
-minimap on top
I've also started to mess a bit with map. I've made a minimap icon but I'm not sure how to keep it on top all the time. It's an imagemap that jumps to label with map screen.
And of course my biggest and most important question is, is it a viable code or is it a complete nonsense? Oh and please try to keep it as simple as possible, I'm really a beginner. Thanks!