Page 1 of 1
collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 1:57 pm
by equinox
Is someone able' to explain me as they are used?
Tnk1000 for help.
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 2:36 pm
by edh
check out the demo I did for Bee-ants "one actor" demo wish,
http://game-editor.com/forum/viewtopic. ... 172#p35327It's overly complicated because it uses only one actor and it's clones, but you should be able to see how the collide and collide.name are used to figure out which actor is being collided with.
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 3:35 pm
by equinox
Thanks. I am studying your code.
Help to understand me please. For instance:
GLOBAL Code #define player_actor "one_actor.0"
-------------------------------------
create Actor script:
if (strcmp (clonename, player_actor) ==0) {y = -95;}
it means:
if (myself == "one_actor.0"){y = -95;} ? its correct?
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 3:41 pm
by edh
That is right. I made a special name for the player's actor. And since the actors all have the same events, I only wanted the player actor to start at that position.
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 4:14 pm
by equinox
Perfect! Thanks.
In collision finish (one actor):
if.......&& strcmp (it collides.clonename, ground_actor)!= 0) jumping = 2;
perhaps means: if(myself->collides, with ground_actor) then jump?
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 4:22 pm
by edh
Ok, that one deserves some explanation...
This tests to see if the collision actors name is not the same (!=) as ground_actor...
strcmp (collides.clonename, ground_actor) != 0
strcmp returns zero if the two strings match.
In this case, we're trying to enable/disable jumping. Since, in my example, jumping increases with each jump action to simulate falling I set the jump to the max jump number. Effectively, that is supposed to disable jumping from midair when you fall off a platform.
There is some unexpected bahavior which keeps it from really working in practice (you can't always jump when you are on a platform because of the flip/flop between collision and collision end with the platform).
So you have it right; it's disabling jump by setting that number, not allowing jump.
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 4:48 pm
by equinox
very,very,very well. thanks1000. With your help, beginning to understand anything one pochino at a time. I read on the script doc:cloneindex......
Do you have an example? It is perhaps used this way:
In Game Maker: for istance:
ID = CreatActor (Hand, x, y);
ID = 123450 <--id of object Hand...then I can do:
1 #ID.x = 10;..ID.FLAG = true..or
2 #(123450).x = 10.... is it used so', perhaps?
..while I wait for one kind answer of yours, continuous to study me the code sorege.
Re: collide/collide.name: how use it?
Posted:
Fri Feb 15, 2008 6:51 pm
by edh
Check this post for some information on how to use the cloneindex
http://game-editor.com/forum/viewtopic. ... 273#p35293DilloDude had some ideas there, too.
Re: collide/collide.name: how use it?
Posted:
Sat Feb 16, 2008 1:46 am
by Bee-Ant
Nicely done EDH