At 19:21 2/22/2001, Will2 wrote:
>Is there anyway to move a sprite to top.
>I  am trying to make a puzzle game where tiles are moved around.
>My problem is that the tile slides behind the tiles that are in front of
>it and dissapears.
>I tried to copy everything into a sprite at the end which puts it on top
>but I have to click it again to move it around.  I want it to move to
>the front and follow the mouse cursor without having to release the
>mouse.
>
>Is there a handler in Dir5 to move a sprite to the front when clicked?
>thanks for any assistances!

What you might try is having a dummy sprite in the highest channel (48 was 
it?). Then when you click on, say sprite 5, you swap the higher sprite's 
cast member with sprite 5's cast member AND swap sprite 5's cast member 
with the dummy cast member. Then have sprite 48 follow the mouseLoc. The 
dummy member could be a single or zero pixel bitmap.

It's been several years since I used D5, so the following code will very 
likely have some syntax problems. You may even have to substitute 'member' 
with 'cast' as I don't recall when 'member' became the norm. Oddly enough I 
can't even test this. the clickOn seems to return a 0 in D7.02. Perhaps it 
should be replaced with the rollover(). Here's the gist of it, though:

on mouseDown
   set clickedSprite = the clickOn
   set theMem = the member of sprite clickedSprite
   set the member of sprite 48 = theMem
   set the member of sprite clickedSprite = "dummy"
   repeat while the stillDown
     set the loc of sprite 48 to the mouseLoc
     updateStage
   end repeat
   set the loc of sprite clickedSprite = the mouseLoc
   set the member of sprite 48 = member "dummy"
   set the member of sprite clickedSprite = theMem
end

Note that any other animations that may be going on will pause while the 
user is dragging the sprite around (due to the tight repeat loop). I'm sure 
there are ways to get around that if you need to, but my D5 memories have 
faded quite a bit & I don't recall which commands & features were available 
back then. For instance, I don't think behaviors were available yet, were they?

Perhaps it could all be handled in the frame script? Set a flag on 
mouseDown that the frame script detects and causes sprite 48 follow the mouse?



--
Mark A. Boyd
Keep-On-Learnin' :)


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to