Point and Click Sample Project
Posted: Sat Apr 20, 2013 8:39 pm
This is a simple game to demonstrate:
- the use of an inventory screen that uses Screen Language per KimiYoriBaka (see http://lemmasoft.renai.us/forums/viewto ... =8&t=12849)
- the use of Screen Language to create a point and click style puzzle.

Each room gets its own screen that looks like this:

Something I did was change the whole background when someone picked something up. That's because I was being lazy and just using the 3d renders.
The fish was done differently:
I could have just used the fish image for the imagebutton, but I wanted to stay consistent with the yellow circle.
Items are defined like this:
Item(name,imagename)
Example:
I made a couple of Screen Actions to help me out.
addItem: Action that adds the item to the player's inventory
addItem(item)
example:
testItem: Action that will test to see if the selected item is a certain item, then change a variable, then optionally remove the item
testItem(item,variable, value, remove)
That test to see if the iFirewood item is selected. If it is, then fireplace_wood is set to True and the item is removed from inventory.
I think it is pretty self explanatory; but then again, I wrote it.
Now to see if it works on Android.
Susan
Download the attached file (PointandClickTest.zip) and unzip it into your Ren'py Files directory to see the code.
- the use of an inventory screen that uses Screen Language per KimiYoriBaka (see http://lemmasoft.renai.us/forums/viewto ... =8&t=12849)
- the use of Screen Language to create a point and click style puzzle.

Each room gets its own screen that looks like this:
Code: Select all
screen outside_room:
on "hide" action Hide("displayTextScreen")
if iFirewood not in inventory and not fireplace_wood:
add "outside_wood.jpg"
imagebutton:
xpos 370
ypos 462
xanchor 0.5
yanchor 0.5
idle "empty.png"
hover "yellow.png"
action [Hide("displayTextScreen"),addItem(iFirewood)]
hovered Show("displayTextScreen", displayText = "Someone left some wood here.")
unhovered Hide("displayTextScreen")
else:
add "outside.jpg"
imagebutton:
xanchor 0.5
yanchor 0.5
xpos 650
ypos 322
idle "empty.png"
hover "yellow.png"
action Jump("kitchen")
hovered Show("displayTextScreen", displayText = "Go to Kitchen.")
unhovered Hide("displayTextScreen")

Something I did was change the whole background when someone picked something up. That's because I was being lazy and just using the 3d renders.
The fish was done differently:
Code: Select all
if iFish not in inventory:
add "herring.png" xpos 500 ypos 160 xanchor 0.5 yanchor 0.5
imagebutton:
xanchor 0.5
yanchor 0.5
xpos 500
ypos 160
idle "empty.png"
hover "yellow.png"
action [Hide("displayTextScreen"),addItem(iFish)]
hovered Show("displayTextScreen", displayText = "Someone left this fish out.")
unhovered Hide("displayTextScreen")
Items are defined like this:
Item(name,imagename)
Example:
Code: Select all
iMatch = Item("Match","match.png")
iFirewood = Item("Firewood","wood.png")
iFish = Item("Fish","herring_item.png")
addItem: Action that adds the item to the player's inventory
addItem(item)
example:
Code: Select all
if iFish not in inventory:
imagebutton:
idle "herring.png"
hover "herring_hover.png"
action addItem(iFish)
testItem(item,variable, value, remove)
Code: Select all
imagebutton:
idle "empty.png"
hover "yellow.png"
action testItem(iFirewood,"fireplace_wood", True, True)
I think it is pretty self explanatory; but then again, I wrote it.
Susan
Download the attached file (PointandClickTest.zip) and unzip it into your Ren'py Files directory to see the code.