|
|
|
ColorCursor
Added on 6/7/1999
|
Code by Detlef Beyer (d.beyer@hermes.de)
This is a simple cursor-behavior to use with color bitmaps
The cursor behavior needs a at least one bitmap attached as cursor. Choose any channel to place the cursor in.
This behavior can be used with or without an animated cursor.
Use this behavior as a frame-script!
property pSprite -- the sprite channel
property pState -- the animation part active
property pMax -- number of elements
property pWait -- time to wait between change of cast
property pTime -- last update
property pAnimFlag -- animate TRUE or FALSE
property pName -- the name-part of the cast
on beginSprite me
puppetSprite pSprite,True
set pState = 0
set pTime = the ticks
set myName = the name of member (the memberNum of sprite pSprite)
set pName = char 1 to length(myName) - 1 of myName
cursor 200 -- hide the org. cursor
end beginSprite
on exitFrame me
if (the ticks > pTime + pWait) AND pAnimFlag then
-- animation mode is on
set pTime = the ticks -- to wait before the next update
if pState < pMax then
set pState = pState + 1
else
set pState = 1
end if
set the memberNum of sprite pSprite to ¬
the number of member (pName & string(pState))
end if
-- show our or the org. cursor?!
if the mouseH > 0 AND the mouseH < the stageRight AND¬
the mouseV > 0 AND the mouseV < the stageBottom then
set the locH of sprite pSprite to the mouseH
set the locV of sprite pSprite to the mouseV
set the visible of sprite pSprite to TRUE
cursor 200
else
-- outside the stage, show the org. cursor
set the visible of sprite pSprite to FALSE
cursor -1
end if
-- now let"s do what all frame-scripts do
go to the frame
end exitFrame
--
on getBehaviorDescription
set myText = "Code by Detlef Beyer " & RETURN
set myText = myText & "This is a simple cursor-behavior to use with color bitmaps" & RETURN
set myText = myText & "The cursor behavior needs a at least one bitmap attached as" & RETURN
set myText = myText & "cursor. Choose any channel to place the cursor in." & RETURN
set myText = myText & "This behavior can be used with or without an animated" & RETURN
set myText = myText & "cursor." & RETURN
return myText
end getBehaviorDescription
on getPropertyDescriptionList
set description = [:]
addProp(description, #pWait,[#default:10, #format:#integer, #comment:"wait time"])
addProp(description, #pMax,[#default:3, #format:#integer, #comment:"# of elements", #range:[#min:1,#max:9]])
addProp(description, #pSprite,[#default:3, #format:#integer, #comment:"cursor sprite channel"])
addProp(description, #pAnimFlag,[#default:true, #format:#boolean, #comment:"Animation on"])
return description
end getPropertyDescriptionList
|
|