Using Director

| sample images | finished movie 1 |

Lingo - Sprite Moveability & Location

Created and designed by Vivienne Trulock for ilikecake, 2005

Simple Jigsaw

see final jigsaw movie.

Set the movie width and height to 700 * 400.

Import jigsaw images, create a 'play again' button, and arrange as in the image.
layout of stage

To make each jigsaw sprite moveable, select it and click on the 'moveable sprite' icon in the sprite properties window.

moveable button

Lingo Script

The sprite script attached to each jigsaw-piece sprite looks something like this. The code tests whether the sprite has been placed within 40 pixels of its correct position. If it has, it sets the sprite to that position, and makes it immovable. LocV is the vertical location, locH is the horizontal location.

on mouseUp me
if sprite(3).locV<(70) then
if sprite (3).locV>(30) then
if sprite(3).locH<(70) then
if sprite(3).locH>(30) then
sprite(3).loc = point (50,50)
sprite(3).moveableSprite = FALSE
end if
end if
end if
end if
end

The numbers differ depending on the position of the piece in the jigsaw. To find the x,y coordinates of a piece of jigsaw, just place it in the correct position in the grid on-stage, and look up the sprites properties.

x-y coordinates

Play Again Script

The sprite script attached to the play-again button looks like this. The sprites location is reset to a position on the right of the stage and the sprites are once again moveable.

on mouseDown me
sprite(3).loc = point (450,150)
sprite(4).loc = point (550,350)
sprite(5).loc = point (550,250)
sprite(6).loc = point (450,50)
sprite(7).loc = point (650,350)
sprite(8).loc = point (450,250)
sprite(9).loc = point (450,350)
sprite(10).loc = point (650,250)
sprite(11).loc = point (550,150)
sprite(12).loc = point (650,150)
sprite(13).loc = point (650,50)
sprite(14).loc = point (550,50)
sprite(3).moveableSprite= TRUE
sprite(4).moveableSprite= TRUE
sprite(5).moveableSprite= TRUE
sprite(6).moveableSprite= TRUE
sprite(7).moveableSprite= TRUE
sprite(8).moveableSprite= TRUE
sprite(9).moveableSprite= TRUE
sprite(10).moveableSprite= TRUE
sprite(11).moveableSprite= TRUE
sprite(12).moveableSprite= TRUE
sprite(13).moveableSprite= TRUE
sprite(14).moveableSprite= TRUE
end

Loop the movie on the final frame.

on exitFrame me
go to the frame
end

Variations

This script rotates the jigsaw piece by 90 degrees on a right click if it is not in its correct position

on mouseUp me
if sprite(3).locV<(70) then
if sprite (3).locV>(30) then
if sprite(3).locH<(70) then
if sprite(3).locH>(30) then
sprite(3).loc = point (50,50)
sprite(3).moveableSprite = FALSE
sprite(3).rotation = 0
end if
end if
end if
end if
end

on rightmouseDown me
if sprite(3).loc = point (50,50)then
sprite(3).rotation = 0
else sprite(3).rotation = integer(sprite(2).rotation + 90) mod 360
end

This script plays the sound of the ding.wav file from the cast on mouse down, in sound channel 2. Simply attach it to the desired sprite.

on mousedown me
puppetsound "ding" 2
end