|
|
|
80's Arcade High Score Name Entry Behavior
Added on 9/2/2005
|
Attach this behavior to a text or field member. You will have to make sure the member is of the right size and such... I suppose I could add all that into a GPDL for you, but that'd be more work for me. ;-)
Anyways, the key here is MAKE SURE TO CHOOSE A MONOSPACED FONT!!!!! If you don't know what I'm talking about then Google it.
- Traditional High Score Name Entry -- and other filters
-- ©2005 by Josh Chunick
property spriteNum, pSprite, pMem, pCount
on beginSprite me
pSprite = sprite(spriteNum)
pMem = pSprite.member
pMem.editable = False
pCount = 1
pMem.text = "AAA"
Case pMem.type of
#text:
pMem.fontStyle = [#plain]
pMem.char[pCount].fontStyle = [#underline]
#field:
pMem.fontStyle = "plain"
pMem.char[pCount].fontStyle = " underline"
end Case
the keyDownScript = string(pSprite) & ".keyDown()"
end
on keyDown me
if keyPressed(123) then
theNum = charToNum(pMem.char[pCount]) - 1
if theNum < 33 then theNum = 96
pMem.char[pCount] = numToChar(theNum)
end if
if keyPressed(124) then
theNum = charToNum(pMem.char[pCount]) + 1
if theNum > 96 then theNum = 33
pMem.char[pCount] = numToChar(theNum)
end if
if pMem.type = #field then pMem.char[pCount].fontStyle = "underline"
if keyPressed(RETURN) then
if pCount > 3 then
Case pMem.type of
#text:
pMem.fontStyle = [#plain]
#field:
pMem.fontStyle = "plain"
end Case
else
pCount = pCount + 1
Case pMem.type of
#text:
pMem.fontStyle = [#plain]
pMem.char[pCount].fontStyle = [#underline]
#field:
pMem.fontStyle = "plain"
pMem.char[pCount].fontStyle = " underline"
end Case
end if
end if
end
on endSprite me
the keyDownScript = EMPTY
end
|
|