Get animation name of collided actor?

You must understand the Game Editor concepts, before post here.

Get animation name of collided actor?

Postby ikarus » Fri Aug 26, 2011 10:59 pm

I have three actors that are all very very similar. I realized that it may be faster just have one actor that has all three animations and just specify the animation name through CreateActor. But each actor has a different collision even. I figured that I just need one even and specify a different thing depending on the animation name. I've been looking around on how to get it, but I'm not quite sure.

I tried using GetAnimName but it still only returns an animation of the even actor even if I give it collide.animindex.
Any ideas?
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Get animation name of collided actor?

Postby ikarus » Fri Aug 26, 2011 11:17 pm

Okay moved forward a bit, I made a type actor string variable and when the actor is created I do this:

Code: Select all
ctype = strcpy(type, GetAnimationName(animindex));


Then I have this in the collide even script editor:

Code: Select all
char ctype;
strcpy(ctype, collide.type);


But when my animation name is blue, this doesn't return true:

Code: Select all
if(ctype == "blue")


I know it's getting the right animation name cause I've made it also strcpy the type to a global char that I have a text actor updating from, and when I hit it the text actor prints out "blue". My only guess is that the name returned is a slightly different string than "blue"???

How would the string actually look like if I use strcpy?????

[edit]
fixed code typo above
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Get animation name of collided actor?

Postby Jagmaster » Fri Aug 26, 2011 11:41 pm

I believe to check a string's vale you use strcmp:
Code: Select all
if( strcmp(ctype, blue)==1)
{
//
}
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Get animation name of collided actor?

Postby ikarus » Fri Aug 26, 2011 11:51 pm

Jagmaster wrote:I believe to check a string's vale you use strcmp:
Code: Select all
if( strcmp(ctype, blue)==1)
{
//
}


still not working, sigh :/
What would cause two strings to not equal each other not, when they look the same?
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Get animation name of collided actor?

Postby ikarus » Fri Aug 26, 2011 11:56 pm

wait something ain't right cause if(strcmp("blue","blue")==1) isn't working :| :| :| :| :?:
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Get animation name of collided actor?

Postby Jagmaster » Sat Aug 27, 2011 12:02 am

whoops! My bad, It needed to be this:
Code: Select all
    if( strcmp(ctype, blue)==0)
    {
    //
    }

Dumb mistake. If it still doesn't work, Idk what the problem is. :P
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: Get animation name of collided actor?

Postby ikarus » Sat Aug 27, 2011 12:04 am

---Down't matter anymore---
Last edited by ikarus on Sat Aug 27, 2011 12:08 am, edited 1 time in total.
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Get animation name of collided actor?

Postby ikarus » Sat Aug 27, 2011 12:07 am

Jagmaster wrote:whoops! My bad, It needed to be this:
Code: Select all
    if( strcmp(ctype, blue)==0)
    {
    //
    }

Dumb mistake. If it still doesn't work, Idk what the problem is. :P

For a second you had me sure my computer was out to destroy everything I ever hoped to achieve lol

Thanks alot :D
>>>>>>>>>>>>>>>>>>>>> http://www.code1011.com <<<<<<<<<<<<<<<<<<<<<<<
ikarus
 
Posts: 143
Joined: Fri Aug 12, 2011 3:06 am
Score: 11 Give a positive score

Re: Get animation name of collided actor?

Postby Jagmaster » Sat Aug 27, 2011 12:10 am

Yeah, sorry about that. :oops:
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron