question about animation

Game Editor comments and discussion.

question about animation

Postby hamdotkeren » Tue Jan 25, 2011 2:45 am

1.what is the code for animation finish in script editor?? (without using animation finish event)

2.I want to create a character, if I press a button repeatedly (eg, the "h") then the character will change into another animation and perform such an attack combo, and if I release a set of repetitive button presses (when the middle combo or end) then the animation will automatically return at the beginning. like a combo hit fighting game in general.
how to apply it in GE?
or if there is such a demo that I mean, could you please show me the link??
hamdotkeren
 
Posts: 13
Joined: Sat Nov 13, 2010 2:10 am
Score: 0 Give a positive score

Re: question about animation

Postby skydereign » Tue Jan 25, 2011 3:13 am

1. Use this.
Code: Select all
if(animpos==nframes-1)
{
    // animation finish code
}


nframes holds the total number of frames in an animation, and animpos is the frame index ranging from 0 to nframes-1.

2. You could use the idea from the above code, and use a variable to hold your actor's place in the combo. I would just use a state variable, like this.
player -> KeyDown (h) -> Script Editor
Code: Select all
switch(state)
{
    case 0: // standing
    // ChangeAnimation to attack
    state=2;
    break;

    case 1: // start combo
    if(animpos>=nframes-2) // not quite the last frame
    {
        // ChangeAnimation to second combo
        state=4;
    }
    break;

    case 4: // second hit in combo
    if(animpos>=nframes-2) // same as above
    {
        // ChangeAnimation to next combo hit (or repeat part of the combo)
        state=4; // this would be used if you are repeating the second hit
    }
    break;

    // and so on
}


Of course you would do this for both directions the player is facing, and have other states that you could enter the combo from, like running perhaps. If you need the state method explained, just ask, but generally speaking this is how you might do it.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: question about animation

Postby hamdotkeren » Tue Jan 25, 2011 9:05 am

this is my demo
there I'm still using animation finish event, I want to without the use of animation finish, but by using scrip editor, can you fix it me!!
Attachments
cek.rar
(38 KiB) Downloaded 74 times
hamdotkeren
 
Posts: 13
Joined: Sat Nov 13, 2010 2:10 am
Score: 0 Give a positive score

Re: question about animation

Postby schnellboot » Tue Jan 25, 2011 11:06 pm

why not do yourself?
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: question about animation

Postby sonicfire » Wed Jan 26, 2011 12:14 am

@ hamdotkeren :

Code: Select all
if(animpos==nframes-1)
{
    // animation finish code
}


..this *is* the same as animation finish! :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: question about animation

Postby hamdotkeren » Wed Jan 26, 2011 7:42 pm

hehehe, I've done it time ago but the code does not work, but somehow now, may I now have received a revelation ... hehehe, thanks to much bro

you are smart peoples...
hamdotkeren
 
Posts: 13
Joined: Sat Nov 13, 2010 2:10 am
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron