animation collide

Non-platform specific questions.

animation collide

Postby DeveG » Sun Dec 12, 2010 11:35 am

how to make when an actors animation collide.eg if its animation 1 to 1 it should destroy.not 1 to 2.
DeveG
 
Posts: 17
Joined: Sun Dec 12, 2010 11:30 am
Score: 2 Give a positive score

Re: animation collide

Postby skydereign » Sun Dec 12, 2010 11:39 am

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");
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: animation collide

Postby DeveG » Sun Dec 12, 2010 12:21 pm

Ski can u do it 4 me
i am gonna upload it.
DeveG
 
Posts: 17
Joined: Sun Dec 12, 2010 11:30 am
Score: 2 Give a positive score

Re: animation collide

Postby skydereign » Sun Dec 12, 2010 12:46 pm

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...
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: animation collide

Postby lcl » Sun Dec 12, 2010 7:09 pm

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:
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: animation collide

Postby DeveG » Sun Dec 12, 2010 10:34 pm

Okay. I will follow u boths advice. :)
DeveG
 
Posts: 17
Joined: Sun Dec 12, 2010 11:30 am
Score: 2 Give a positive score

Re: animation collide

Postby lcl » Sun Dec 12, 2010 10:35 pm

:D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: animation collide

Postby DeveG » Sun Dec 12, 2010 11:59 pm

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.
Attachments
colurs deluxe.rar
here's the demo
(708.26 KiB) Downloaded 58 times
colurs deluxe.rar
(708.26 KiB) Downloaded 52 times
Last edited by DeveG on Mon Dec 13, 2010 1:02 am, edited 1 time in total.
DeveG
 
Posts: 17
Joined: Sun Dec 12, 2010 11:30 am
Score: 2 Give a positive score

Re: animation collide

Postby skydereign » Mon Dec 13, 2010 12:10 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: animation collide

Postby DeveG » Mon Dec 13, 2010 1:04 am

i had uploaded the demo.
DeveG
 
Posts: 17
Joined: Sun Dec 12, 2010 11:30 am
Score: 2 Give a positive score

Re: animation collide

Postby skydereign » Mon Dec 13, 2010 1:24 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: animation collide

Postby DeveG » Mon Dec 13, 2010 1:35 am

can u edit my demo and make it correct.
please................. :(
then upload it.
in credits i will put ur name 4 scripting.
DeveG
 
Posts: 17
Joined: Sun Dec 12, 2010 11:30 am
Score: 2 Give a positive score

Re: animation collide

Postby skydereign » Mon Dec 13, 2010 1:38 am

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).
Attachments
colours.ged
(3.44 KiB) Downloaded 54 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest