Field.htm 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Field variable</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. variable = any legal variable
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. If you haven't read up on the TYPE command, you might want to do so before continuing. <br />
  21. <br />
  22. 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.
  23. <br>
  24. <br>
  25. See also: <a class=small href=Type.htm>Type</a>, <a class=small href=End Type.htm>End Type</a>.
  26. </td>
  27. </tr>
  28. </table>
  29. <h1><a href=../2d_examples/Field.bb>Example</a></h1>
  30. <table>
  31. <tr>
  32. <td>
  33. ; Define the CHAIR Type <br />
  34. <br />
  35. Type CHAIR <br />
  36. Field X <br />
  37. Field Y <br />
  38. Field HEIGHT <br />
  39. End Type <br />
  40. <br />
  41. ; Create 100 new chairs using FOR ... NEXT using the collection name of ROOM <br />
  42. <br />
  43. For tempx = 1 to 10 <br />
  44. For tempy = 1 to 10 <br />
  45. room.chair = New Chair <br />
  46. room\x = tempx <br />
  47. room\y = tempy <br />
  48. room\height = Rnd(0,10) ; set a random height 0 to 10 <br />
  49. Next <br />
  50. Next <br />
  51. <br />
  52. ; Move them all over 1 (like the description example from TYPE command) <br />
  53. <br />
  54. For room.chair = Each chair <br />
  55. room\x = room\x + 1 <br />
  56. Next
  57. </td>
  58. </tr>
  59. </table>
  60. <br>
  61. <a target=_top href=../index.htm>Index</a><br>
  62. <br>
  63. 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>
  64. </html>