Understanding Drag and Drop - Creating Clue Hunting Mystery

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
Calissa Leigh
Regular
Posts: 54
Joined: Wed Apr 11, 2012 11:04 am
Completed: No games, just books. :)
Projects: Murder Mystery 1
Organization: Arcato Publishing
Location: Among the people, and Cajuns
Contact:

Understanding Drag and Drop - Creating Clue Hunting Mystery

#1 Post by Calissa Leigh » Wed Apr 18, 2012 7:40 pm

I'm trying to understand the coding I would need for displaying a scene, an item in the scene can be picked up, and when clicked on, it will be in an inventory screen.

Once the item is in the inventory, the player can use the item on another part of the screen to unlock a visual (short animation or another image with a clue to be clicked on and add to the inventory, etc.)

I'm playing around with:

Code: Select all

init python:

    def detective_dragged(drags, drop):
This is from the tutorial. So you can pick up something on the screen and drag it to another part of the screen to activate something. Is there something on when clicking it slides to your inventory?

And then I found this: http://lemmasoft.renai.us/forums/viewto ... ry#p193803

I'm hoping for something similar to Drawn: (http://www.bigfishgames.com/download-ga ... index.html). There's a display box in the bottom thirds of the screen and you'll collect items and then drag them to the right spot to unlock things. (Not the only element to this game, but hoping to include drag and drop to do this.)

So I wanted to try making the inventory. Just to test it out, I tried:

Code: Select all

screen inventory_scr:
    hbox:
        xalign 0.5 yalign 0.4
        idle "icon.png" 
        hover "icon.png"
        action QuickSave()
I was testing it out with just having something in the inventory to start with so I can see where it would be located.

And I can hide it:

Code: Select all

        textbutton "Return" action Hide("inventory_scr") xalign 0.1 yalign 0.9 xminimum 100


And a button to show the inventory when needed within the quick_menu:

Code: Select all

     textbutton _("Inventory") action Show('inventory_scr"')

It gave me an error.

Code: Select all

idle is not a keyword argument or valid child for the hbox statement.
So... if anyone can point out what might not be understanding?


So I'm wondering about clicking on the item so that it goes to the inventory screen and making the item drag-able (instead of just clickable).

Something within the inventory screen like setting up the drag group position within the inventory screen.

User avatar
sciencewarrior
Veteran
Posts: 356
Joined: Tue Aug 12, 2008 12:02 pm
Projects: Valentine Square (writer) Spiral Destiny (programmer)
Location: The treacherous Brazilian Rainforest
Contact:

Re: Understanding Drag and Drop - Creating Clue Hunting Myst

#2 Post by sciencewarrior » Wed Apr 18, 2012 7:59 pm

Shouldn't there be a button there?

Code: Select all

screen inventory_scr:
    hbox:
        xalign 0.5 yalign 0.4
        imagebutton:
            insensitive "icon.png" 
            idle "icon.png" 
            hover "icon.png"
            action QuickSave()

Keep your script in your Dropbox folder.
It allows you to share files with your team, keeps backups of previous versions, and is ridiculously easy to use.

Calissa Leigh
Regular
Posts: 54
Joined: Wed Apr 11, 2012 11:04 am
Completed: No games, just books. :)
Projects: Murder Mystery 1
Organization: Arcato Publishing
Location: Among the people, and Cajuns
Contact:

Re: Understanding Drag and Drop - Creating Clue Hunting Myst

#3 Post by Calissa Leigh » Wed Apr 18, 2012 8:46 pm

Yus! That's it. :D

I'm going to try to mix it in with a drag and drop feature now. Thanks a bunch. :)

Post Reply

Who is online

Users browsing this forum: No registered users