65 lines
1.6 KiB
HTML
65 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<title>Blitz3D Docs</title>
|
|
<link rel=stylesheet href=../css/commands.css type=text/css>
|
|
</head>
|
|
<body>
|
|
<h1>Field variable</h1>
|
|
<h1>Parameters</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
variable = any legal variable
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1>Description</h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
If you haven't read up on the TYPE command, you might want to do so before continuing.
|
|
|
|
<br />
|
|
|
|
<br />
|
|
When you define a custom Type, you need to assign some variables to track within in. Using the Field command within the Type .. End Type commands, you set a variable that can be used for EACH object created with the NEW command.
|
|
<br>
|
|
<br>
|
|
See also: <a class=small href=Type.htm>Type</a>, <a class=small href=End Type.htm>End Type</a>.
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h1><a href=../2d_examples/Field.bb>Example</a></h1>
|
|
<table>
|
|
<tr>
|
|
<td>
|
|
; Define the CHAIR Type
|
|
<br />
|
|
|
|
<br />
|
|
Type CHAIR
|
|
<br />
|
|
Field X
|
|
<br />
|
|
Field Y
|
|
<br />
|
|
Field HEIGHT
|
|
<br />
|
|
End Type
|
|
<br />
|
|
|
|
<br />
|
|
; Create 100 new chairs using FOR ... NEXT using the collection name of ROOM
|
|
<br />
|
|
|
|
<br />
|
|
For tempx = 1 to 10
|
|
<br />
|
|
For tempy = 1 to 10
|
|
<br />
|
|
room.chair = New Chair
|
|
<br />
|
|
room\x = tempx
|
|
<br />
|
|
room\y = tempy
|
|
<br />
|
|
room\height = Rnd(0,10) ; set a random height 0 to 10
|
|
<br />
|
|
Next
|
|
<br />
|
|
Next
|
|
<br />
|
|
|
|
<br />
|
|
; Move them all over 1 (like the description example from TYPE command)
|
|
<br />
|
|
|
|
<br />
|
|
For room.chair = Each chair
|
|
<br />
|
|
room\x = room\x + 1
|
|
<br />
|
|
Next
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<a target=_top href=../index.htm>Index</a><br>
|
|
<br>
|
|
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Field&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
|
|
</html>
|