Solid but more variables?

N

NoFontNL

Guest
Can you make more variables, that don't require an instance to be made?
For example, you can get the solid state of an object with object_get_solid()
I have multiple objects and some are for example semi solid, or some blocks are moving or some other specific properties that apply to like 6 objects. How would I create those and how would I check them in GMS1.4?
 

FrostyCat

Redemption Seeker
Keep the specific property defaults in global map data structures.
Code:
global.obj_example_defaults = ds_map_create();
global.obj_example_defaults[? "movable"] = false;
...
Then you can apply these defaults in objects by referencing these maps.
Code:
movable = global.obj_example_defaults[? "movable"];
...
Given how much data modeling a strategy board game would entail, I'm surprised you didn't sort this one out yourself.
 
N

NoFontNL

Guest
I must be completely blind, but I don't see how that works. Is global.obj_example_defaults the map name or should obj_example be obj_theObjectWhereIWantDefaultsFor ? And how do I set these things, is that in the room start or where should I put it.?
 

FrostyCat

Redemption Seeker
I must be completely blind, but I don't see how that works. Is global.obj_example_defaults the map name or should obj_example be obj_theObjectWhereIWantDefaultsFor ? And how do I set these things, is that in the room start or where should I put it.?
If you've handled any project-wide data at the global scope (e.g. save data) and actually learned the lesson, this is not a question you would have to ask.

The map setup happens at the very beginning of the game (e.g. using an empty first room or gml_pragma("global", ...);). The part referencing the map occurs in the Create event of the object implementing the default-setting behaviour. global.xxx_defaults is the map and xxx is the object.

Comments like yours just pisses me off about the state of how GM users are educated, and highlights the urgent need for a higher standard of literacy on event timing and data-driven code. And in case you read me wrong, I'm actually pissed off about how the people who taught you left you (and most other rookies I deal with daily) in a state unable to understand my instructions on non-action code, not you specifically.
 
N

NoFontNL

Guest
Well thanks for explaining. I just never thought of them that way. I'm sorry if I pissed you off. Have a nice day.
 
Top