collide/collide.name: how use it?

Game Editor comments and discussion.

collide/collide.name: how use it?

Postby equinox » Fri Feb 15, 2008 1:57 pm

Is someone able' to explain me as they are used?

Tnk1000 for help.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide/collide.name: how use it?

Postby edh » Fri Feb 15, 2008 2:36 pm

check out the demo I did for Bee-ants "one actor" demo wish, http://game-editor.com/forum/viewtopic. ... 172#p35327

It'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.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: collide/collide.name: how use it?

Postby equinox » Fri Feb 15, 2008 3:35 pm

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?
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide/collide.name: how use it?

Postby edh » Fri Feb 15, 2008 3:41 pm

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.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: collide/collide.name: how use it?

Postby equinox » Fri Feb 15, 2008 4:14 pm

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?
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide/collide.name: how use it?

Postby edh » Fri Feb 15, 2008 4:22 pm

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.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: collide/collide.name: how use it?

Postby equinox » Fri Feb 15, 2008 4:48 pm

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.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide/collide.name: how use it?

Postby edh » Fri Feb 15, 2008 6:51 pm

Check this post for some information on how to use the cloneindex http://game-editor.com/forum/viewtopic. ... 273#p35293

DilloDude had some ideas there, too.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: collide/collide.name: how use it?

Postby Bee-Ant » Sat Feb 16, 2008 1:46 am

Nicely done EDH :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron