adventure game - finding objects [SOLVED]

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
saskuto
Regular
Posts: 64
Joined: Fri Jan 15, 2010 2:56 pm
Contact:

adventure game - finding objects [SOLVED]

#1 Post by saskuto » Sat Feb 27, 2010 8:33 am

Ok so I've read up a bit about inventories and adding money etc. http://www.renpy.org/wiki/renpy/doc/coo ... ney_System But what I actually want to do is have my character find certain objects. As he goes on his adventure he is meant to find seven treasures. So rather than have a money system/shops etc. After a particular event he will 'discover' a treasure which will go into his inventory where he can view it and read a bit about it. Is there anyway to make this happen?

any help much appreciated :)
Last edited by saskuto on Mon Mar 22, 2010 7:05 pm, edited 1 time in total.

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: adventure game - finding objects

#2 Post by JQuartz » Sat Feb 27, 2010 12:43 pm

saskuto wrote:After a particular event he will 'discover' a treasure which will go into his inventory where he can view it and read a bit about it. Is there anyway to make this happen?
You can use an overlay to show the inventory button which will call an inventory label like so:

Code: Select all

init:
    $ treasure1=False
    $ show_button=True
init python:
   
    def inventory_button():
        if show_button:
            ui.textbutton('See inventory', clicked=ui.callsinnewcontext('inventory'))
    config.overlay_functions.append(inventory_button)

label start:
    "Walk"
    $ treasure1=True
    "Found treasure1"
    "End"
    $ renpy.full_restart()
    
label inventory:
    $ show_button=False
    $ ui.vbox(xalign=.5)
    if treasure1:
        $ ui.imagebutton("treasure1.png", "treasure1_hover.png",clicked=ui.callsinnewcontext('see_treasure1'))
    $ ui.textbutton('Return to game', clicked=ui.jumps('return_to_game'))
    $ ui.close()
    $ ui.interact()
label see_treasure1:
    $ ui.image("treasure1.png", xalign=.5, yalign=.2)
    "Treasure1 info"
    return
label return_to_game:
    $ show_button=True
    return
    
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]