|
|
|
Sprite Group Movement behavior
Added on 6/10/1999
|
Sprite Group Movement behavior
property spriteNum
property pGroupName, pMouseLoc
on mouseDown me
set pMouseLoc = point(the mouseH, the mouseV)
add the actorList, me
end
on mouseUp me
deleteOne the actorList, me
end
on mouseUpOutside me
deleteOne the actorList, me
end
on stepFrame me
set lNewLoc = point(the mouseH, the mouseV)
set lOffset = lNewLoc - pMouseLoc
set pMouseLoc = lNewLoc
sendAllSprites(#moveMyself_SGM, pGroupName, lOffset)
end
on moveMyself_SGM objRef, lPassedGroup, lOffset
if lPassedGroup = pGroupName then
set the loc of sprite spriteNum = (the loc of sprite spriteNum) + lOffset
end if
end
on getPropertyDescriptionList
set description = [:]
addProp description,#pGroupName,[#default:"", #format:#string,#comment:"Group Name:"]
return description
end
on getBehaviorDescription
set lText = ""
put "--======= Sprite Group Movement behavior =======--" & RETURN after lText
put "This behavior, allows multiple sprites to move as if " after lText
put "they are one. Each sprite with this behavior and the " after lText
put "same group name will move together whenever clicked " after lText
put "and dragged. Try it. You"ll see." & RETURN & RETURN after lText
put "As always, if you use this behavior I would " after lText
put "like a mention in your credits. Enjoy." & RETURN & RETURN after lText
put "--== © Rett Crocker 1997" & RETURN after lText
put " --== rett@zapgun.com" & RETURN after lText
put " --== www.zapgun.com" & RETURN after lText
return lText
end
|
|