Page 1 of 1

animation collide

PostPosted: Sun Dec 12, 2010 11:35 am
by DeveG
how to make when an actors animation collide.eg if its animation 1 to 1 it should destroy.not 1 to 2.

Re: animation collide

PostPosted: Sun Dec 12, 2010 11:39 am
by skydereign
If you mean two clones then do it like this.
actor -> Collision with actor (repeat enabled or disabled) -> Script Editor
Code: Select all
if(collide.animindex==animindex)
{
    DestroyActor("Event Actor");
    DestroyActor("Collide Actor");
}

Re: animation collide

PostPosted: Sun Dec 12, 2010 12:21 pm
by DeveG
Ski can u do it 4 me
i am gonna upload it.

Re: animation collide

PostPosted: Sun Dec 12, 2010 12:46 pm
by skydereign
If you are going to use gameEditor, you really should learn by doing it yourself. I've given you the code required to do it, it's really just a matter of copying. If you really don't know how to implement this, then I can implement it, but it's better to ask if you don't understand something and build your game yourself. It takes more effort, but you won't be relying on others in the future. Anyway, I prefer Sky over Ski...

Re: animation collide

PostPosted: Sun Dec 12, 2010 7:09 pm
by lcl
skydereign wrote:If you are going to use gameEditor, you really should learn by doing it yourself. I've given you the code required to do it, it's really just a matter of copying. If you really don't know how to implement this, then I can implement it, but it's better to ask if you don't understand something and build your game yourself. It takes more effort, but you won't be relying on others in the future. Anyway, I prefer Sky over Ski...

You're absolutely right, skydereign.

DeveG,
Doesn't help very much just to get everything done
ready for you. And, no one likes to do it very long.
Because then the one who "helps you" is actually making the game, not you.

So, DeveG, try doing things yourself. :wink:

Re: animation collide

PostPosted: Sun Dec 12, 2010 10:34 pm
by DeveG
Okay. I will follow u boths advice. :)

Re: animation collide

PostPosted: Sun Dec 12, 2010 10:35 pm
by lcl
:D

Re: animation collide

PostPosted: Sun Dec 12, 2010 11:59 pm
by DeveG
can u do 4 me just this thing. i tried my best but it dosent work :( .
i need help 4 when the same animations collide it should destroy,but it should be the animations of 3 actors of same colours.
eg blue to blue.

Re: animation collide

PostPosted: Mon Dec 13, 2010 12:10 am
by skydereign
You really should explain your setup a little more. I'm going to assume you are using rgb variables to change their color, instead of animations. This code will destroy two actors of the same color. The code I previously gave you will destroy two of the same animation. And I believe I gave you one that will destroy three or more of the same actors.
Code: Select all
if(collide.r==r && collide.g==g && collide.b==b)
{
    DestroyActor("Event Actor");
    DestroyActor("Collide Actor");
}


So it looks like you are making a puzzle game, and if I put it all together, I've pretty much made the puzzle game. So if you can put them together, then that would be better. What you need to do is use the two methods from this topic and apply it to the other method (again assuming they are the same name). If you still can't get it, I can piece it together, but am more likely to make a puzzle game using these mechanics myself in the future.

Re: animation collide

PostPosted: Mon Dec 13, 2010 1:04 am
by DeveG
i had uploaded the demo.

Re: animation collide

PostPosted: Mon Dec 13, 2010 1:24 am
by skydereign
The problem is that they aren't colliding. So the collide code never gets triggered. If that is the case, you can use the getactor function to get the Actor*, and then use it to find the rgb or animindex to compare. But really, this kind of thing should be done with arrays.

I believe one work around though, is to have them colliding by one pixel, so extend their border to be one black pixel bigger, that way you can line them up while they are still colliding.

-Edit
You also need to set collision to repeat. That and properly aligning them will make it work. Of course this will not work with any more than three actors, as it only destroys two of them.

Re: animation collide

PostPosted: Mon Dec 13, 2010 1:35 am
by DeveG
can u edit my demo and make it correct.
please................. :(
then upload it.
in credits i will put ur name 4 scripting.

Re: animation collide

PostPosted: Mon Dec 13, 2010 1:38 am
by skydereign
I just edited the other version, since I assume you want it to destroy all actors of the same color in collision.

-Edit
This isn't perfect, mostly because of your images, but that is easy to fix. Also, it won't always work, if you allow them to be destroyed immediately (when you press game mode).