Declarinring in Global codes?

Non-platform specific questions.

Declarinring in Global codes?

Postby poopbrigade » Sat Oct 02, 2010 3:35 am

Hey and Hello every one I'm making my game called BattleMage and I was thinking of transfering codes from one to another and maybe merging em but I bCus I'm tired of the repeating codes and I also tried to learn global thingys and learned a bit of it, now heres my question=>
How can I set a name of an animation to another 1 like
walk_L=WalkingLeftMonkeySlowly
so that I just asign their names and copy past codes.....

Thank in advance XD..... :mrgreen:
When life gives you oranges, make orange juice. When life gives you poop, make fertilizer not poop juice.

Image
Current project __ CorPsEdEaRtH
Estimated work done __ 12%
User avatar
poopbrigade
 
Posts: 129
Joined: Thu Aug 27, 2009 12:17 pm
Location: In Earth. Being Burried XD
Score: 46 Give a positive score

Re: Declarinring in Global codes?

Postby CybrKidX » Sun Oct 03, 2010 4:49 pm

That's a bit confusing... but if I understand you correctly, you want to apply the same change-animation code to multiple actors. To do this, you'll need the different actors to have the same animation names, such as Walk_left, Walk_right, etc.

Put this in your global code:
Code: Select all
void TurnLeft()
{
    *you may put any code here that you do not wish to repeat*
    ChangeAnimation("Event Actor", "Walk_left", FORWARDS);
}


Then, to use this code later on any actor you wish, you simply copy this into the script editor:
Code: Select all
TurnLeft();


Thats a subprocedure, by the way, and you can name it watever you want... I just chose TurnLeft for the example.
CybrKidX
 
Posts: 11
Joined: Fri May 15, 2009 12:35 am
Score: 0 Give a positive score

Re: Declarinring in Global codes?

Postby DST » Sun Oct 03, 2010 4:58 pm

As far as i know, you cannot actively change an animation name once it has been added to the animation list.

What you can do, however, is use define.

#define Walk_L WalkingLeftMonkeySlowly

If you aren't familiar: Put it in a global script window, and add as many as you want. Any time you type the first thing, it replaces it with the second.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Declarinring in Global codes?

Postby poopbrigade » Mon Oct 04, 2010 2:28 am

thnx sry for the long reply my internet broke.
XD.. trying it now..
When life gives you oranges, make orange juice. When life gives you poop, make fertilizer not poop juice.

Image
Current project __ CorPsEdEaRtH
Estimated work done __ 12%
User avatar
poopbrigade
 
Posts: 129
Joined: Thu Aug 27, 2009 12:17 pm
Location: In Earth. Being Burried XD
Score: 46 Give a positive score

Re: Declarinring in Global codes?

Postby Fuzzy » Fri Nov 19, 2010 8:22 pm

Excessive use of the #define can make bug hunting painful and makes it harder to share code.

That being said its never stopped me. You can do some pretty nifty things with #define.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest