The basic gist is that the player clicks the button, a variable is switched that hides the button and moves an image that was hidden underneath it. Pretty simple.
But for some reason the buttons stop working in one of two scenarios:
1. Two turns pass.
2. The button is supposed to reappear at the left side. It never does.
Also, the last image (in this case, the bag of beans), has a habit of jumping around if transported first. If it's removed, the next set up does this. Oddly enough, the bag of beans seem to be the only ones where the button makes it to the left correctly.
Considering all the objects are handled identically..I'm not sure what the deal is.
Here is the code, if it helps.
Code: Select all
label init_puzzle:
$ renpy.block_rollback()
python:
fox_position = 'right'
fox_moving = False
goose_position = 'right'
goose_moving = False
beans_position = 'right'
beans_moving = False
raft_position = 'right'
raft_moving = False
RAFT_Y = .6
FOX_Y = .1
GOOSE_Y = .25
BEANS_Y = .4
RAFT_Y = .6
RIGHT_X = .8
LEFT_X = .2
firstMove = False
solved = False
label transport_puzzle:
scene puzzle_river
show raft:
xpos RIGHT_X ypos RAFT_Y
show fox:
xpos RIGHT_X ypos FOX_Y
show goose:
xpos RIGHT_X ypos GOOSE_Y
show beans:
xpos RIGHT_X ypos BEANS_Y
#set up all the buttons/images according to variables
#FOX
if fox_position == 'right' and fox_moving == False:
show fox:
xpos RIGHT_X ypos FOX_Y
$ui.imagebutton("gfx/fox.png", "gfx/fox.png", clicked=ui.returns(("fox", None)), xpos = RIGHT_X, ypos = FOX_Y )
elif fox_position == 'right' and fox_moving:
if raft_position != fox_position:
show raft:
xpos LEFT_X ypos RAFT_Y
ease 3.0 xpos RIGHT_X ypos FOX_Y
$renpy.pause(3.0)
show raft:
xpos RIGHT_X ypos FOX_Y
ease 3.0 xpos LEFT_X ypos FOX_Y
show fox:
xpos RIGHT_X ypos FOX_Y
ease 3.0 xpos LEFT_X ypos FOX_Y
$raft_position = fox_position = "left"
$fox_moving = False
$RAFT_Y = FOX_Y
elif fox_position == "left" and fox_moving == False:
show fox:
xpos LEFT_X ypos FOX_Y
$ui.imagebutton("gfx/fox.png", "gfx/fox.png", clicked=ui.returns(("fox", None)), xpos = LEFT_X, ypos = FOX_Y )
else:
if raft_position != fox_position:
show raft:
xpos RIGHT_X ypos RAFT_Y
ease 3.0 xpos LEFT_X ypos FOX_Y
$renpy.pause(3.0)
show fox:
xpos LEFT_X ypos FOX_Y
ease 3.0 xpos RIGHT_X ypos FOX_Y
show raft:
xpos LEFT_X ypos FOX_Y
ease 3.0 xpos RIGHT_X ypos FOX_Y
$raft_position = fox_position = "right"
$fox_moving = False
$RAFT_Y = FOX_Y
#GOOSE
if goose_position == 'right' and goose_moving == False:
show goose:
xpos RIGHT_X ypos GOOSE_Y
$ui.imagebutton("gfx/goose.png", "gfx/goose.png", clicked=ui.returns(("goose", None)), xpos = RIGHT_X, ypos = GOOSE_Y )
elif goose_position == 'right' and goose_moving:
if raft_position != goose_position:
show raft:
xpos LEFT_X ypos RAFT_Y
ease 3.0 xpos RIGHT_X ypos GOOSE_Y
$renpy.pause(3.0)
show goose:
xpos RIGHT_X ypos GOOSE_Y
ease 3.0 xpos LEFT_X ypos GOOSE_Y
show raft:
xpos RIGHT_X ypos GOOSE_Y
ease 3.0 xpos LEFT_X ypos GOOSE_Y
$raft_position = goose_position = "left"
$goose_moving = False
$RAFT_Y = GOOSE_Y
elif goose_position == "left" and goose_moving == False:
show goose:
xpos LEFT_X ypos GOOSE_Y
$ui.imagebutton("gfx/goose.png", "gfx/goose.png", clicked=ui.returns(("goose", None)), xpos = LEFT_X, ypos = GOOSE_Y )
else:
if raft_position != goose_position:
show raft:
xpos LEFT_X ypos RAFT_Y
ease 3.0 xpos RIGHT_X ypos GOOSE_Y
$renpy.pause(3.0)
show goose:
xpos LEFT_X ypos GOOSE_Y
ease 3.0 xpos RIGHT_X ypos GOOSE_Y
show raft:
xpos LEFT_X ypos GOOSE_Y
ease 3.0 xpos RIGHT_X ypos GOOSE_Y
$raft_position = goose_position = "right"
$goose_moving = False
$RAFT_Y = GOOSE_Y
#BEANS
if beans_position == 'right' and beans_moving == False:
show beans:
xpos RIGHT_X ypos BEANS_Y
$ui.imagebutton("gfx/beans.png", "gfx/beans.png", clicked=ui.returns(("beans", None)), xpos = RIGHT_X, ypos = BEANS_Y )
elif beans_position == 'right' and beans_moving:
if raft_position != beans_position:
show raft:
xpos LEFT_X ypos RAFT_Y
ease 3.0 xpos RIGHT_X ypos BEANS_Y
$renpy.pause(3.0)
show raft:
xpos RIGHT_X ypos BEANS_Y
ease 3.0 xpos LEFT_X ypos BEANS_Y
show beans:
xpos RIGHT_X ypos BEANS_Y
ease 3.0 xpos LEFT_X ypos BEANS_Y
$raft_position = beans_position = "left"
$RAFT_Y = BEANS_Y
$beans_moving = False
elif beans_position == "left" and beans_moving == False:
show beans:
xpos LEFT_X ypos BEANS_Y
$ui.imagebutton("gfx/beans.png", "gfx/beans.png", clicked=ui.returns(("beans", None)), xpos = LEFT_X, ypos = BEANS_Y )
else:
if raft_position != beans_position:
show raft:
xpos RIGHT_X ypos RAFT_Y
ease 3.0 xpos LEFT_X ypos BEANS_Y
$renpy.pause(3.0)
show raft:
xpos LEFT_X ypos BEANS_Y
ease 3.0 xpos RIGHT_X ypos BEANS_Y
show beans:
xpos LEFT_X ypos BEANS_Y
ease 3.0 xpos RIGHT_X ypos BEANS_Y
$raft_position = beans_position = "right"
$RAFT_Y = BEANS_Y
$beans_moving = False
$result = ui.interact()
$moveWhat =result[0]
if moveWhat == "fox":
if not firstMove:
$firstMove = True
$fox_moving = True
if moveWhat == "goose":
if not firstMove:
$firstMove = True
$goose_moving = True
if moveWhat == "beans":
if not firstMove:
$firstMove = True
$beans_moving = True
if firstMove and not solved:
if fox_position == 'left' and goose_position == 'left' and goose_position != beans_position:
jump final_puzzle_lose
#puzzle lost
if goose_position == 'left' and beans_position == 'left' and fox_position != goose_position:
jump final_puzzle_lose
#puzzle lost
if goose_position == 'left' and fox_position == 'left' and beans_position == 'left':
jump final_puzzle_win
$solved = True
#puzzle won
jump transport_puzzle
label final_puzzle_lose:
"You lose. Try again?" #obviously placeholder
jump init_puzzle
label final_puzzle_win:
"You win! Yay!" #again, really placeholder
Any help would be appreciated, thank you!