Hi all,
Type obj 'initialise the user-defined type that holds all the objects that can be in the map
Field x:Int 'the horizontal position on the map
Field y:Int 'the vertical position on the map
Field item:Int 'the item that will be displayed on the map
Field scanned:Byte 'a true / false flag to check if the item has been scanned that pass
End Type
Global map:TList=CreateList() 'initialise the list that will hold the map
For initmapx=0 To 63 'Initialise all horizontal map objects
For initimapy=0 To 63 'initialise all vertical map objects
Global mapobj:obj=New obj 'make a new map object
mapobj.x=initmapx*64 'set the x value of the map object to it's correct position
mapobj.y=initmapy*64 'set the y value of the map object to it's correct position
mapobj.item=0 'set the item to the default blank item
ListAddLast(map,mapobj) 'add the new object to the list
Next
Next
Global state=0 'a game direction flag
Global finish=False 'a flag to see whether the program has ended
'---main---
Repeat 'the main game loop
Cls
For a=EachIn map
DrawRect(a.x,a.y,64,64)
Next
Flip
If KeyHit(KEY_ESCAPE) Then finish=True
Until finish=True 'repeat the loop until the program has ended
I get an error on the
For a=EachIn map
line, saying that the variable type must be an object. I've trawled through time and time again, but can't work out the cause of the problem. Could anyone kindly advise?
Many thanks, M
|