Events mean you can now do this:-
on_something = function( )
print("Oh no! Something happened to " + .target.props["name"] );
ent = ent_create();
ent.events["on_something"] = on_something;
ent.props["name"] = "Billy";
trg = trg_create_entity_position_trigger( ent, vertex( 50, 60 ), "on_something" );
When the entity reaches position 50,60 an event 'on_something' is fired for the entity we created and named as 'Billy'. If we set the trigger to 'never expiring' (or otherwise reactivate it) we can fire this event whenever this entity steps on 50,60 (bear in mind we also have area tests for circles, rectangles and more) - this makes it ideal for switches and various other game triggers :)
We can now use it to start defining various collision callbacks; so setting an "on_collided" callback will result in that being called whenever two entities collide:-
on_collided_player = function()
ent1 = .props["entity"];
print( ent1.props["name"] + " has collided with " + .target.props["name"] );
I really need to start crafting the tilemap stuff so I can throw out a simple pacman clone to test all the things we have so far.
So far this GMGX engine experiment is turning out to be something special. What we have right now is a simple 2d engine that runs entirely on scripts written in a simple yet powerful language. My intention is to now bolster the graphical ability of this engine, providing tile mapping, parallax scrolling and other goodies so that it can be used in 'real 2d games'...