Page 1 of 1

Multi hit

PostPosted: Tue Oct 22, 2013 7:31 pm
by Behdadsoft
Hi.

I want make a game like street of rage but before every thing I Need know how work multi hit ? mean hit Punches and kicks together.

Thanks

Re: Multi hit

PostPosted: Wed Oct 23, 2013 10:16 pm
by knucklecrunchgames
lol I'm making a game like this too, good luck.

Re: Multi hit

PostPosted: Thu Oct 24, 2013 1:47 pm
by Behdadsoft
lol I'm making a game like this too, good luck.


ok. I have question : how can use one key for several animation? mean if I press SPACE Key the first time run animation1, and if press SPACE Key Secondly run animation2 and so on.

Thanks

Re: Multi hit

PostPosted: Thu Oct 24, 2013 3:30 pm
by Wertyboy
Behdadsoft wrote:
lol I'm making a game like this too, good luck.


ok. I have question : how can use one key for several animation? mean if I press SPACE Key the first time run animation1, and if press SPACE Key Secondly run animation2 and so on.

Thanks

Haven't try this before, But Variables and Timer should work ;)

Re: Multi hit

PostPosted: Sat Oct 26, 2013 12:53 am
by Soullem
What I would do is to create a variable called hitStage or whatever you would want. I would increase this by 1 everytime you hit the attack button (space). Then I would create a switch statement that plays the attack animation depending on the value of hitStage. Then you could write a code that if you do not press attack after a while it resets hitStage to 0, making you start back on the first part of your attack combo. Thats what i'd do. If you need more hinters on the coding just ask!

Re: Multi hit

PostPosted: Sat Nov 16, 2013 8:44 pm
by Behdadsoft
thanks Soullem :)
+1

but I have a Problem:

I wrote this code for change animation when my player each press a key.

Player(Axel) => Key Down => a => Script Editor
Code: Select all
hit++;
switch (hit)
{
    case 0:
    ChangeAnimation("Axel", "Axel Right-LeftPunch", FORWARD);
    break;
 
    case 1:
    ChangeAnimation("Axel", "Axel Right-LeftPunch", FORWARD);
    break;
 
    case 2:
    ChangeAnimation("Axel", "Axel Right-RightPunch", FORWARD);
    break;
 
    case 3:
    ChangeAnimation("Axel", "Axel Right- Kick", FORWARD);
    break;
}


But I don't know how can reset hit with timer when player don't press any key?

Re: Multi hit

PostPosted: Tue Nov 19, 2013 11:44 pm
by bat78
Global Code:
Code: Select all
short int checksum;


Key Down even of your actor (Repeat Disable):
Code: Select all
checksum += 1;
if (checksum >= 3) checksum = 1;
if (checksum == 1) x += 5;
if (checksum == 2) x -= 5;


Of course, you can change x += 5 and x -=5 with anything you wish. Like changing animation or so.
Thats how you can use one single button, used for a several functions. Well at least thats how i would do.
_______________________________________________________________________________________________

If you want to use simple timer, made with code you can use that down. It works only if you don't change the
game's default FPS rate. By default its 30. That fps determine the speed of transmitting frames of an movement.
Global Code:
Code: Select all
void after(const int seconds)
{
    int ms; ms++;
    if (ms / 25 == seconds) hit = 0; //Or what happens when the time is up
}


Any Actor -> Draw Actor:
Code: Select all
after(10); //10 stands for the seconds you wish

_______________________________________________________________________________________________

Street of rage is a good game of SEGA. You can also use dual key hit:
Axel -> Key Down -> qe (all keys are pressed)
Code: Select all
//code


You can also do the same for combos:
Axel -> Key Dow -> qwe (all keys are pressed in order)
Code: Select all
//code