x=m.snake_X
y=m.snake_Y
for each seg in m.seg_list
x=x+seg.Len*seg.xDelta
y=y+seg.Len*seg.yDelta
end for
text_field.SetCursorPos(x, y)
text_field.SendByte(32) ' 32 is ascii space, could use asc(" ")
End Sub
Function snkMoveForward(text_field As Object)As Boolean
m.EraseEndBit(text_field)
tail=m.seg_list.GetTail()
REM
REM the following shows how you can use an AA's member functions to perform the same
REM functions the BrightScript . operator does behind the scenes for you (when used on an AA).
REM there is not point to this longer method other than illustration
REM
len=tail.Lookup("Len") ' same as len = tail.Len (or tail.len, BrightScript syntax is not case sensative)
len = len-1
if len=0 then
m.seg_list.RemoveTail()
else
tail.AddReplace("Len",len) ' same as tail.Len=len
endif
Commentaires sur ces manuels