Page 1 of 1

animation script

PostPosted: Tue May 15, 2012 11:48 am
by Behdadsoft
Hi. I want make a game like mortal kombat. I maked a kabal character that is some animation fo example Kick, Box , .... and I want So write script for any animation that Is the easiest way. In other words how to write a script for Each animation?
for example i want write kabal.kick=1 run kick animation and etc.Overall I need a Variable Structure.

Image

Re: animation script

PostPosted: Tue May 15, 2012 4:22 pm
by skydereign
That isn't how animations work (you don't write scripts for animations). Animations are changed with the ChangeAnimation function and you can use a different variable to store what the player is doing (kicking or similar). You could even use the animindex variable to determine what the actor is doing, but I suggest creating your own variable for this. You should look into the state method, it should be able to do what you want. http://game-editor.com/State_Method

Re: animation script

PostPosted: Tue May 15, 2012 6:48 pm
by Behdadsoft
Thank you for your help :D
I'll read it and asked if I was still a question. :wink:

Re: animation script

PostPosted: Tue May 15, 2012 10:47 pm
by Fojam
im making a game with that sort of style (its a super smash bros) and basically the best thing to do is make a variable called attacksHolder or something, and have different numbers represent different attacks. and when the animation finishes, reset the attacksHolder variable to 0. that way, when you collide with your enemy, you can check if attacks holder is a certain number, deal x amount of damage to the enemy and make him go x distance

Re: animation script

PostPosted: Wed May 16, 2012 7:57 am
by Behdadsoft
I want when once press a key run animation and when hold it repeat animation. i maked this script but don't work good.
Code: Select all
if (K_highbox==0)
{

    ChangeAnimation("Event Actor", "K_highbox", FORWARD);
    Kabal.xvelocity=0;
}

Re: animation script

PostPosted: Wed May 16, 2012 4:54 pm
by skydereign
Change FORWARD to NO_CHANGE. FORWARD will constantly try to start the animation from the beginning, NO_CHANGE will let the animation continue, but it changes it to the proper animation if it isn't the same.

Re: animation script

PostPosted: Wed May 16, 2012 7:47 pm
by Behdadsoft
Thanx, very good. :D

for select screen : I want when select kabal, in game play with it and when select Smoke play with Smoke.

Please Guide ME.

Image

Re: animation script

PostPosted: Wed May 16, 2012 9:32 pm
by Fojam
could you post your source?

Re: animation script

PostPosted: Wed May 16, 2012 9:47 pm
by Behdadsoft
Sorry I can't. :|

Re: animation script

PostPosted: Wed May 16, 2012 11:55 pm
by skydereign
All you need to do is have a filled region actor, and on the mouse button down event, create the actor you want the player to play as.

Re: animation script

PostPosted: Thu May 17, 2012 6:26 am
by Behdadsoft
You can leave a sample?
I have a 2 different .ged file and don't know How do I do it.

Re: animation script

PostPosted: Thu May 17, 2012 3:52 pm
by skydereign
I prefer not to. With something like this, it isn't complex enough that providing a ged would help.
Behdadsoft wrote:I have a 2 different .ged file and don't know How do I do it.

Does this mean one ged is the character select, and one is the actual game? If so, you'll need to set a variable and save it before loading the game version. From there, in the view's create actor, you can use loadVars, and then create the proper player (depending on the value of the variable). For instance, when you press down on kabal's filled region, it sets the player_selected variable to 1 and uses saveVars to save it. Lastly it loads the other game with LoadGame.

In the other game's view actor, you would add something like this. Load the variable file created from the saveVars (remember save groups need to be named the same as well as the variables) and then have a switch statement or similar.
Code: Select all
switch(player_selected)
{
    case 1:
    // Create kabal
    break;
}

Re: animation script

PostPosted: Thu May 17, 2012 7:29 pm
by Behdadsoft
Thank you.

in Switch code :

Code: Select all
switch(player_selected)
{
    case 1:
    // Create kabal
    break;
}


We have two Players, when select One of them How create Kabal or smoke?

Re: animation script

PostPosted: Thu May 17, 2012 10:33 pm
by skydereign
I'm pretty sure you can figure that out if you think about it. If two players are selectable, then you could use two variables to determine which each player picks. Or, if only first player picks, and the second player must always be the other choice, then that is even simpler. The value 1 in that switch stands for the player choosing kabal (so you can change the comment to call CreateActor for kabal). You can also have another value (perhaps 2) which stands for smoke.

The important thing to understand is not exactly what code I provide, but understand what I'm saying. If you can understand the idea behind the method I am suggesting, you should be able to figure these things out without having to ask a new question for everything.

Re: animation script

PostPosted: Fri May 18, 2012 9:31 am
by Behdadsoft
Thank You.

I understand your statements and I'm trying to solve this problem. :D