| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>Const variablename</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- variablename - any valid variable name and its assignment
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- This declares a variable as a constant (a variable whose value will never change and cannot be changed) and assigns the value to it.
<br />
-
<br />
- Assign constants to values you know will not change in your game (screen width, height - scoring values - etc). This reduces the load of the variable memory, since Blitz knows it will never change size unlike other variables which can grow and shrink in size based on what value it holds.
- <br>
- <br>
- See also: <a class=small href=Global.htm>Global</a>, <a class=small href=Local.htm>Local</a>, <a class=small href=Dim.htm>Dim</a>.
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/Const.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; CONST Example
<br />
-
<br />
- Const scrWidth=640
<br />
- Const scrHeight=480
<br />
- Const alienscore=100
<br />
-
<br />
- Graphics scrWidth,scrHeight
<br />
-
<br />
- Print "The point value for shooting any alien is always " + alienscore
- </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=Const&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|