@mygame4: To make things easier for you to understand I'll try to explain it in a different way.

In 3D GameStudio, every entity you create - it could be a model of your player character for example, but also a sprite, a tree... - has a fixed set of so-called "FLAGS". A flag is very much like a "sign" the entity gives to the A7 engine. For example the "visible" flag tells the engine whether the entity should be visible or not, the "passable" flag tells the engine whether this entity should be used for collision detection or not etc.

When it comes to flags, it is always a question of "is it set?" - yes or no. Now, you don't really need a whole integer number to store a value of zero (for "no") or 1 (for "yes"), it would be a waste of memory, so several flags are now stored in the same integer number.

You have to know three things about a flag:
- the name
- what it does
- how to set/reset it

You can look up the name of a flag in the manual. There it also says what the flag is for. Just search for "flags". And for setting a flag - in liteC you can write this:

Code:
set(my, VISIBLE);



This would set the visible flag of the entity that is currently referred to in the "my"-pointer. You can exchange "visible" with any other flag you can find in the manual - just be aware of the consequences. If you want to set a flag to "off", you can use this:

Code:
reset(my, VISIBLE);



This sets the flag back to "off" state.


Now, back to your question. What does |= ?
Well, writing this:

Code:
my.flags |= visible;



...is exactly the same as...

Code:
set(my, VISIBLE);



So instead of the "set()" function you may also use |=. But if you ask me, you shouldn't do that because it makes your code harder to read. But just in case you encounter |= in other people's code, now you know, basically it is for setting a flag (actually there ARE other ways to use it, but I've never seen it anywhere). By the way, for re-setting a flag, you can use &=. However, I'd recommend the "reset()" function instead.


I hope I could help you.


Greets,



Alan

Last edited by Alan; 04/14/10 19:20.