Code: Select all
screen jigsaw:
draggroup:
drag:
drag_name "00"
child "darkness.jpeg"
draggable False
xpos coorlistx[0] ypos coorlisty[0]
drag:
drag_name "01"
child "darkness.jpeg"
draggable False
xpos coorlistx[0] ypos coorlisty[1]
drag:
drag_name "02"
child "darkness.jpeg"
draggable False
xpos coorlistx[0] ypos coorlisty[2]
drag:
drag_name "10"
child "darkness.jpeg"
draggable False
xpos coorlistx[1] ypos coorlisty[0]
drag:
drag_name "11"
child "darkness.jpeg"
draggable False
xpos coorlistx[1] ypos coorlisty[1]
drag:
drag_name "12"
child "darkness.jpeg"
draggable False
xpos coorlistx[1] ypos coorlisty[2]
drag:
drag_name "20"
child "darkness.jpeg"
draggable False
xpos coorlistx[2] ypos coorlisty[0]
drag:
drag_name "21"
child "darkness.png"
draggable False
xpos coorlistx[2] ypos coorlisty[1]
drag:
drag_name "22"
child "darkness.png"
draggable False
xpos coorlistx[2] ypos coorlisty[2]
drag:
drag_name "30"
child "empty space.png"
draggable False
xpos coorlistx[3] ypos coorlisty[0]
drag:
drag_name "31"
child "empty space.png"
draggable False
xpos coorlistx[3] ypos coorlisty[1]
drag:
drag_name "00 piece"
child im.Crop("puzzle1.jpg", 0,0, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[0][0] ypos piecelist[0][1]
drag:
drag_name "01 piece"
child im.Crop("puzzle1.jpg", 200,0, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[1][0] ypos piecelist[1][1]
drag:
drag_name "02 piece"
child im.Crop("puzzle1.jpg", 400,0, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[2][0] ypos piecelist[2][1]
drag:
drag_name "03 piece"
child im.Crop("puzzle1.jpg", 600,0, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[3][0] ypos piecelist[3][1]
drag:
drag_name "04 piece"
child im.Crop("puzzle1.jpg", 800,0, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[4][0] ypos piecelist[4][1]
drag:
drag_name "05 piece"
child im.Crop("puzzle1.jpg", 0,250, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[5][0] ypos piecelist[5][1]
drag:
drag_name "06 piece"
child im.Crop("puzzle1.jpg", 200,250, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[6][0] ypos piecelist[6][1]
drag:
drag_name "07 piece"
child im.Crop("puzzle1.jpg", 400,250, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[7][0] ypos piecelist[7][1]
drag:
drag_name "08 piece"
child im.Crop("puzzle1.jpg", 600,250, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[8][0] ypos piecelist[8][1]
drag:
drag_name "09 piece"
child im.Crop("puzzle1.jpg", 800,250, 200,250)
droppable False
dragged piece_dragged
xpos piecelist[9][0] ypos piecelist[9][1]
Code: Select all
label puzzle:
call screen jigsaw
if ([coorlistx[movedplace[0]], coorlisty[movedplace[1]]] in piecelist):
python:
t1 = piecelist[movedpiece]
t2 = piecelist.index([coorlistx[movedplace[0]], coorlisty[movedplace[1]]])
piecelist[movedpiece] = [coorlistx[movedplace[0]],coorlisty[movedplace[1]]]
piecelist[t2] = t1
else:
$ piecelist[movedpiece] = [coorlistx[movedplace[0]],coorlisty[movedplace[1]]]
if piecelist == [[coorlistx[0],coorlisty[0]],
[coorlistx[1],coorlisty[0]],
[coorlistx[2],coorlisty[0]],
[coorlistx[3],coorlisty[0]],
[coorlistx[0],coorlisty[1]],
[coorlistx[1],coorlisty[1]],
[coorlistx[2],coorlisty[1]],
[coorlistx[3],coorlisty[1]],
[coorlistx[0],coorlisty[2]],
[coorlistx[1],coorlisty[2]]]:
jump win
jump puzzle
Code: Select all
label puzzle1:
scene black
image whole = "puzzle1.jpg"
python:
coorlistx = [10, 130, 250, 370]
coorlisty = [10, 217, 424]
piecelist = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]
for i in range(12):
x = renpy.random.randint(0, 59) + 621
y = renpy.random.randint(0, 480)
piecelist[i] = [x,y]
movedpiece = 0
movedplace = [0, 0]
jump puzzle
I tried to modify the original to fit 10 pieces, cutting them into 200x250 pieces out of a 1000x500 picture (I probably screwed with the x and y coordinates, hard.) but mostly I want to understand about:
>The use of this and how exactly it clicks with each thing "xpos piecelist[3][0] ypos piecelist[3][1]"
> The reason why the "blank spaces" were named 00, 01, 02, 10, 11 was there something I missed?
And the reason why this error appears based on the code above:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/dekupuzzles.rpy", line 184, in script
python:
File "game/dekupuzzles.rpy", line 191, in <module>
piecelist[i] = [x,y]
IndexError: list assignment index out of range
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/dekupuzzles.rpy", line 184, in script
python:
File "C:\MMHP\renpy-7.1.1-sdk\renpy\ast.py", line 882, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\MMHP\renpy-7.1.1-sdk\renpy\python.py", line 1913, in py_exec_bytecode
exec bytecode in globals, locals
File "game/dekupuzzles.rpy", line 191, in <module>
piecelist[i] = [x,y]
File "C:\MMHP\renpy-7.1.1-sdk\renpy\python.py", line 713, in do_mutation
return method(self, *args, **kwargs)
IndexError: list assignment index out of range