A menu that slides out from the left or right on mouseenter. Just drop onto a sprite and fill in the blanks. All the properties should be pretty straight forward.
--Side scrolling menu.
--Created by Brent Moseley. April, 2000
--brent099@xoommail.com
property mysprite -- current sprite number
property othersprite -- Additional sprite to "attach" to current sprite.
property destloc -- location sprite should stop at
property startloc -- location sprite begins and returns to
property speed -- speed at which the sprite moves to and from destination
property mo -- 1 if mouse is over sprite, 0 if not
property myframe -- frame to go to when the sprite is pressed
property myoffset -- horizontal offset of othersprite
property newmember -- member to change to on mousedown
property oldmember -- member to change to on mouseup
on beginsprite me
mysprite = the spritenum of me
oldmember = the member of sprite mysprite
if startloc = 0 then
startloc = the loc of sprite mysprite
else
the loch of sprite mysprite = startloc
end if
end
on mouseenter me
mo = 1
end
on mouseleave me
mo = 0
the member of sprite mysprite = oldmember
end
on mousedown me
if myframe = 0 then
return
end if
the member of sprite mysprite = newmember
end
on mouseup me
if myframe = 0 then
return
end if
the member of sprite mysprite = oldmember
go to frame myframe
end
on prepareframe me
if mo = 1 then --if the mouse is over
if the loch of sprite mysprite < destloc and speed > 0 then --if it"s moving left
the loch of sprite mysprite = the loch of sprite mysprite + speed
end if
if the loch of sprite mysprite > destloc and speed < 0 then --if it"s moving right
the loch of sprite mysprite = the loch of sprite mysprite + speed
end if
else --if the mouse is not over
if the loch of sprite mysprite > startloc and speed > 0 then -- if it"s moving right
the loch of sprite mysprite = the loch of sprite mysprite - speed
end if
if the loch of sprite mysprite < startloc and speed < 0 then -- if it"s moving left
the loch of sprite mysprite = the loch of sprite mysprite - speed
end if
end if
the loch of sprite othersprite = the loch of sprite mysprite + myoffset
end
on getPropertyDescriptionList
set description = [:]
addProp description,#startloc, ¬
[#default:-50, #format:#integer, #comment:"Sprite"s horizontal origin. (0 for current loc)"]
on getBehaviorDescription
return "Side scrolling menu." & return & return & ¬
"Drop onto a sprite and fill in the blanks." & return & ¬
"All the properties should be pretty straight forward." & return & return & ¬
"Created by Brent Moseley. April, 2000" & return & "brent099@xoommail.com"
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA