Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help me with this (small?) problem.

Status
Not open for further replies.

Jowst

Programmer
Jun 22, 2005
1
NL
Hi!

I'm new to this forum and to Director but I have an urgent question.

I want to be able to click on a sprite, and after that I want to click on another sprite and the first sprite must "jump" to the location of the second sprite.

The code I have so far is capable of clicking on a sprite but the sprite jumps to the second sprite without clicking on the second on. I know this is because I iserted the sprite number (1) in it.

Maybe it gets a bit more clear when I just give you the code I have so far :)


property pThisSprite

on beginSprite me
set pThisSprite = sprite(me.spriteNum)
end beginSprite

on mouseUp me
sprite(pThisSprite).loc = sprite(1).loc
end


So I dont have the chance to click on the sprite it supposed to jump to.

Any help will be very great!

Thanks in advance!
Joost Tibben
 
I think I might have been able to figure this one out for you, you just need to add this script to each of the sprites that are going to be moving. I didn't quite understand what you wanted to do, but I think this is pretty close.

You also need to add a startMovie movie script that sets the gFirstClick and gSecondClick to ""

Hope this helps!!

Happy Programming,
Greg Hudy


global gFirstClick
global gSecondClick



on mouseUp me
if gFirstClick = "" then
gFirstClick = sprite(me.spriteNum)
else
if gFirstClick = sprite(me.spriteNum) then
gFirstClick = sprite(me.spriteNum)
else
if gFirstClick <> sprite(me.spriteNum) then
gSecondClick = sprite(me.spriteNum)
gFirstClick.loc = gSecondClick.loc
gFirstClick = EMPTY
gSecondClick = EMPTY

end if
end if
end if
end

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top