reading types

Blitz3D Forums/Blitz3D Programming/reading types

; Define the CHAIR Type

Type CHAIR
Field X
Field Y
Field HEIGHT
End Type

; Create 100 new chairs using FOR ... NEXT using the collection name of ROOM 

For tempx = 1 to 10
For tempy = 1 to 10
room.chair = New Chair
room\x = tempx
room\y = tempy
room\height = Rnd(0,10) ; set a random height 0 to 10
Next
Next 

; Move them all over 1 (like the description example) 

For room.chair = Each chair
room\x = room\x + 1
Next
cChair = 13

While Not KeyHit(1)

cChair = cChair + KeyHit(3) - KeyHit(2)

For room.chair = Each chair

If chair=cChair Then
		g=room\x
		j=room\y
		h=room\height
EndIf

chair = chair + 1 ;; WHAT YOU FORGOT TO ADD.

Next

chair = 0

Text 0,10,""+g
Text 0,20,""+j
Text 0,30,""+h

Flip
Cls

Wend

End