|
-
Flash Intermediate
[MX] Drag And Drop!!!
Just a very basic question, shouldn't be too hard to answer, but I couldn't find it anywhere else. (Couldn't think of any keywords)
I have a basic game board, with nine gray circles in it. there are also nine chocolates, and They can be dragged anywhere on the screen. But I need a script so that when a user drops the piece, it slides to the center of the intended spot.
Ex:
on(release) {
stopdrag(this)
this. hit test of circle?
if yes, this._x and this._y = circle1._x and circle1._y
I don't know, something like that. do I need an array? as the smiley says,
CONFUSED
In the process of designing a quirky little game engine called gulp. Check out it's progress below: @ my blog.
---
Check out my blog at XenElement.com
-
Try this:
PHP Code:
on(release) {
stopDrag(this);
if (_root.circle.hitTest(this._x, this._y, true))
{
this._x = _root.circle._x;
this._y = _root.circle._y;
}
}
Last edited by Eastwinn; 11-24-2008 at 11:31 PM.
Reason: Mistake
-
Flash Intermediate
The code seems like it would work, but for some reason, it doesn't see the circle. I exported for as with linkage, but it still dosent work.
RRRGGGH!!
In the process of designing a quirky little game engine called gulp. Check out it's progress below: @ my blog.
---
Check out my blog at XenElement.com
-
Did you set its instance name to "circle"? You only need to export a movie clip to AS if you plan to create it dynamically in the code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|