Re: Trying to learn BGT again

The helper layer of the help file is where those so called include scripts are described in detail. the actual BGT scripts performing the defined functionality are stored in the BGT folder itself, in the subfolder called includes. You don't need to worry about them in greater detail other than reading about what they do in the help file.
If you want to use one of these in your game, you need to use the #include directive which is described in chapter 13 of the language tutorial, called Using multiple scripts. When you do this, the engine will first look for the file with the provided name in its own include directory; if it cannot be found there, it will look for the file iin your current working directory, that is the directory where your main script is saved. Only if the include file cannot be found in either of these two locations, the engine will throw a compilation error.
A loop must always be used whenever you want to do anything with the keyboard. If you only do something like:
if (key_pressed (KEY_ESCAPE))
in your code, without a loop, it will perform the instruction just once. In other words, it will look just now and only now, only once, to see if escape is pressed. It sees that it's not, because to make it work in this case, you would need to have escape pressed literally at the same millisecond when it is actually checking the state of the key, which is practically impossible to do. Then, since escape is not pressed and there are no more instructions to carry out after that check, the script will simply exit. When execution has reached the last instruction in the main function and there is nothing more to do, the script just stops running. What you need to do is keep checking if the key is pressed over and over again, until you explicitly tell the engine to do something else, every few milliseconds. That's what loops are used for. Without them, you wouldn't be able to establish the continuum of the game, so to speak, in any way.
Hope this helps,
Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=160443#p160443

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
http://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Reply via email to