But I have it set up where 12 pieces spawn on the left and the player must drag a specific 8 of them over to the frame on the left. Every piece snaps into place except for the piece that is circled in blue on the solution screenshot. I have only gotten it to snap once and go onto the novel but can't seem to replicate what I did.
The corresponding image file name is piece-2 which I'm assuming means it's not a list or range issue because it is in the middle of the list. If anyone has any ideas for what might be causing this I would greatly appreciate.
Here is my code so far:
Code: Select all
init python:
def piece_drop(dropped_on, dragged_piece):
global finished_pieces
if dragged_piece[0].drag_name == dropped_on.drag_name:
dragged_piece[0].snap(dropped_on.x, dropped_on.y)
dragged_piece[0].draggable = False
finished_pieces += 1
if finished_pieces == solution_pieces:
renpy.jump("poster_complete")
# define certain global variables that will keep of track of things like number of pieces, the final locations, how many are fixed, etc.
default poster_pieces = 12
default solution_pieces = 8
default poster_size = (668, 688)
default piece_coordinates = [(1224,377),(1237,369),(1526,380),(1544,392),(1553,716),(1533,704),(1206,702),(1243,701)]
default intitial_piece_coordinates = [(579,214),(272,537),(254,866),(596,554),(605,203),(249,545),(572,882),(271,214),(262,890),(253,190),(563,536),(603,887)]
default finished_pieces = 0
screen poster:
image "bg wood.png"
draggroup:
# draggable pieces
for i in range(poster_pieces):
drag:
drag_name i
pos intitial_piece_coordinates[i]
anchor(0.5, 0.5)
focus_mask True
drag_raise True
image "Pieces/piece-%s.png" % (i + 1)
# snappable spots
for i in range(solution_pieces):
drag:
drag_name i
draggable False
droppable True
dropped piece_drop
pos piece_coordinates[i]
anchor(0.5, 0.5)
focus_mask True
image "Pieces/piece-%s.png" % (i + 1) alpha 0.0
Code: Select all
call screen poster
label poster_complete:
scene bg test alley
o "This has to be the location."