Animindex problem

Game Editor comments and discussion.

Animindex problem

Postby RippeR7420 » Sat Jan 05, 2013 12:51 am

Hello everybody. I'm having an issue with animindex.

Here is my code:

PowerUp-> Collision-> TopSide of Brick-> Reapeat: Yes-> Script Editor
Code: Select all
if(CoinBrick.animindex==2)

{
    yvelocity=-10;
    yvelocity=min(max(yvelocity, -10), -10);
}


Now, This code will not work for me. But, If i set "if(CoinBrick.animindex==2)" to "if(CoinBrick.animindex==0)" it will work.
like this:

PowerUp-> Collision-> TopSide of Brick-> Reapeat: Yes-> Script Editor
Code: Select all
if(CoinBrick.animindex==0)

{
    yvelocity=-10;
    yvelocity=min(max(yvelocity, -10), -10);
}


Any ideas why this would be happening?

Thanks in advance! and +1 :)


-RippeR
Last edited by RippeR7420 on Sat Jan 05, 2013 1:49 am, edited 1 time in total.
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Animindex problem

Postby Hblade » Sat Jan 05, 2013 1:03 am

what are your animations? Name them in order from top to bottom
It could be that animindex either doesn't exist or is incorrect
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Animindex problem

Postby RippeR7420 » Sat Jan 05, 2013 1:42 am

animindex 0: Shiny brick0001

animindex 1:
Dead brick

animindex 2: Bump brick0001


Those are the only animations for that actor. Exactly how they're spelled, and In that order.
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Animindex problem

Postby Hblade » Sat Jan 05, 2013 1:43 am

try this:
Code: Select all
switch(animindex)
{
    case 2:
        //code here
    break;
}


Also set repeat on if that doesn't work :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Animindex problem

Postby RippeR7420 » Sat Jan 05, 2013 1:46 am

Actually, I don't know how that would work :/. You know in mario when there is a mushroom on top of a brick, and when you hit that brick it bounces up?
That's what i'm trying to do haha.
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Animindex problem

Postby Hblade » Sat Jan 05, 2013 1:50 am

oooh :)

When you hit the brick from the bottom, and the mushroom is created, just have on the mushroom:
Code: Select all
Create Actor:
yvelocity=-5;


on create actor xD When its created it'll go "POP". If you notice in SMW, you can see how if mario runs by that bush in level 1, a mushroom pops up but still jumps
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Animindex problem

Postby RippeR7420 » Sat Jan 05, 2013 2:08 am

Well kinda haha, I already got the power up to pop out of the block. :)

When the power up is moving on top of the blocks, then you hit one from the bottom that has not yet been hit, The power up will bounce in the air again!
Does that make any sense? haha :lol:
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Animindex problem

Postby Hblade » Sat Jan 05, 2013 3:05 am

oh o.o I don't know how to do that easilly lol. sorry o3o
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Animindex problem

Postby RippeR7420 » Sat Jan 05, 2013 3:24 am

Haha it's okay :)

Not really a big problem right now, Just seein if somehow could answer that animindex problem!
CURRENT PROJECTS:

-Olo: The Sword Shaman http://game-editor.com/forum/viewtopic.php?f=4&t=12919

-The Wrath of Blob: (On the back burner)

-StickMcGee - Blast to the Future http://game-editor.com/forum/viewtopic.php?f=4&t=13660
User avatar
RippeR7420
 
Posts: 391
Joined: Mon Apr 27, 2009 4:16 pm
Location: Salt Lake City, Utah.
Score: 23 Give a positive score

Re: Animindex problem

Postby skydereign » Sat Jan 05, 2013 3:47 am

The problem is you are not being clone specific by typing CoinBrick. That is called actor specific. CoinBrick will almost always be referencing the lowest indexed version of the actor (one exception being if an actor of the same type was created in the same event). It looks like you can't use gE's built in methods (like collide.var) since you are using three actors, unless of course Brick and CoinBrick are actually the same actor. If they are the same, then you can use collide.animindex. Otherwise, you'll need some way of determining which CoinBrick actor you want the variable of.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest