Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-14-2001, 06:18 PM   #1
elisha
Registered User
 
Join Date: Jun 2001
Posts: 1
Default

Hi All,

I'm very new to action scripting and could really use some help!

I am trying to create a jigsaw puzzle (with the classic puzzle piece shape) in Flash and I want the user to drag and drop pieces to a specific location in the puzzle. If they drop a puzzle piece into the right location I want the piece to lock into place and a sound to be played.

So far I am able to do most everything except lock the piece in place. I don't want the user to be able to move a piece once he/she has placed it in the right location. Is it possible to lock it and stop the drag action for that particular piece? Thanks for any advice!

Cheers,

Elisha
elisha is offline   Reply With Quote
Old 06-14-2001, 07:48 PM   #2
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Default

Jesse's site has a great example of this on the Draco & Friends stuff (my son loves it). You should check it out.
Anyhoo... first get the exact coordinates for each peace, or at least a bounding box worth of coordinates. In the code for the release, you should have it check to see if the dragged MC is within the range of the target coordinates. Very simple stuff. It'll look something like this:

Define within each piece the range of coordinates you want it to snap to...
dest_x1, dest_x2, dest_y1, dest_y2
Code:
on (release) {
    if ((pzlpc1._x >= pzlpc1.dest_x1 && pzlpc1._x <= pzlpc1.dest_x2) &&(pzlpc1._y >= pzlpc1.dest_y1 &&pzlpc1._y <= pzlpc1.dest_y2)) {
        setProperty (pzlpc1, _x, 131.7); //  point x to snap
        setProperty (pzlpc1, _y, 296.3); // point x to snap
    } else {
       setProperty (pzlpc1, _x, 450); // point of x origin
       setProperty (pzlpc1, _y, 250); // point of y origin
    }
}
Hope that helps ya... I adapted that code from a F4 paperdoll project of mine and it worked beautifully.

[Edited by 20 Ton Squirrel on 06-14-2001 at 01:54 PM]
20 Ton Squirrel is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag and Drop question? jbking ActionScript 1.0 (and below) 1 04-30-2004 02:55 PM
Drag and Drop.. basic question tonyaskinner ActionScript 1.0 (and below) 1 02-11-2004 11:22 AM
drag and drop question truth789 ActionScript 1.0 (and below) 5 07-24-2003 05:19 PM
Drag and Drop question teaches49 ActionScript 1.0 (and below) 2 01-15-2003 01:47 PM
A Drag and Drop Question S3kS ActionScript 1.0 (and below) 3 04-24-2001 12:59 PM


All times are GMT. The time now is 04:27 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.