Missing identifier

BlitzMax Forums/BlitzMax Beginners Area/Missing identifier

emperor42(Posted 2015) [#1]
Just started a new project and I'm trying to create a list of objects "Ttile" but im only producing one at the moment. But i keep getting the message "identifier 'p' not found" on the "For p:Ttile = EachIn objectList" line. Can anyone help me out?

Strict

Const WIDTH=1280,HEIGHT=960
Const DEPTH=32,HERTZ=60

Incbin "lunar_surface2.png"

Global tile:TImage = LoadImage("incbin::lunar_surface2.png")

Global objectlist:TList = New TList

Type Ttile
Field x#,y#

Method New ()
If objectlist = Null
objectlist = New TList
EndIf
objectlist.AddLast Self
End Method

Function Create:Ttile (x#, y#)
Local p:Ttile = New Ttile
p.x = x
p.y = y
objectlist.Addlast p
Return p
End Function

Function UpdateAll ()
For p:Ttile = EachIn objectList
p.DrawTile
Next
End Function


Method DrawTile () 'use of method
DrawImage tile,x,y
End Method

End Type

Ttile.Create (0,0)

While Not KeyHit( KEY_ESCAPE )
Cls

Ttile.UpdateAll ()

Flip

Wend


GfK(Posted 2015) [#2]
Function UpdateAll ()
For Local p:Ttile = EachIn objectList
p.DrawTile
Next
End Function



Brucey(Posted 2015) [#3]
As GfK says, you missed out "Local" from your variable declaration.