Kingdom Hearts Movement - LMB & RMB combo

Posted By: WoYoSensei

Kingdom Hearts Movement - LMB & RMB combo - 10/14/09 06:16

Hi
I try modify a little this code by adding a LMB & RMB combination (LMB - left mouse button, RMB - right mouse button). I have something like this:


player.c

Code:
if(mouse_left == 0 && mouse_left_press == 1)		mouse_left_press = 0;
		if(mouse_left == 1 && mouse_left_press == 0 && my.animblend >= stand) 
		{
			mouse_left_press = 1;
			my.blendframe = punch_a;
			if(my.jumping_mode == 1) 	airborne_punch = 1;
			else								airborne_punch = 0;
			my.movement_mode = 1;
			combo_continue = 0;
		}
		if(mouse_right == 0 && mouse_right_press == 1)	mouse_right_press = 0;
		if(mouse_right == 1 && mouse_right_press == 0 && my.animblend >= stand)
		{
			mouse_right_press = 1;
			my.blendframe = punch_f;
			if(my.jumping_mode == 1) 	airborne_punch = 1;
			else								airborne_punch = 0;
			my.movement_mode = 1;
			combo_continue = 0;
		}
	}
	//
	if(my.movement_mode == 1) 
	{
		if(my.jumping_mode != 10)										my.jumping_mode = 0;
		else if(my.animate >= 60 && my.animblend >= stand)		my.jumping_mode = 0;
		//
		if(mouse_left == 0 && mouse_left_press == 1)
			mouse_left_press = 0;
		if(mouse_left == 1 && mouse_left_press == 0 && my.animate >= 30 && combo_continue == 0) 
		{	mouse_left_press = 1; combo_continue = 1; }
		if(mouse_right == 0 && mouse_right_press == 1)
			mouse_right_press = 0;
		if(mouse_right == 1 && mouse_right_press == 0 && my.animate >= 30 && combo_continue == 0) 
		{	mouse_right_press = 1; combo_continue = 2; }
	}
	//
	if(my.movement_mode == 2) 
	{
		my.jumping_mode = 0;
		if(mouse_left == 0 && mouse_left_press == 1)
			mouse_left_press = 0; 
		if(mouse_left == 1 && mouse_left_press == 0 && my.animate >= 30 && combo_continue == 0) 
		{	mouse_left_press = 1; combo_continue = 1; }
		if(mouse_right == 0 && mouse_right_press == 1)
			mouse_right_press = 0; 
		if(mouse_right == 1 && mouse_right_press == 0 && my.animate >= 30 && combo_continue == 0) 
		{	mouse_right_press = 1; combo_continue = 2; }
	}
}



and animation.c

Code:
ent_animate(my,"punch_b",100,0);
				my.animate = 100;
				my.blendframe = stand;
				if(my.moving == 1) 
				{
					if(key_shift == 1)		my.blendframe = walk;
					else							my.blendframe = run; 
				}
				if(combo_continue == 1) 
				{
					combo_continue = 0;
					my.blendframe = punch_c;
				}
				else
					my.movement_mode = 0;
				if (combo_continue == 2)
				{
					combo_continue = 0;
					my.blendframe = punch_f;	
				}
				else
					my.movement_mode = 0;
				
			}



How`s it working? Not working, that`s a problem... Well, it should be working something like this:
when I have a punch_b animation and press LMB, then combo_continue = 1 and play animation punch_c, and when I press RMB then set combo_continue = 2 and play animation punch_f, after that finish the sequence. It`s simple, but I don`t know why it`s not working smirk Can anybody help me resolve this problem? Thank you and sorry for my english. I hope you can understand me.
Posted By: Ottawa

Re: Kingdom Hearts Movement - LMB & RMB combo - 10/14/09 15:20

Hi!

A suggestion :

add {...} Winged brackets to enclose instruction lists in your
if

They are not needed if you have one instruction. In your code you have
more than one line of instructions per if

as in
else
airborne_punch = 0;
my.movement_mode = 1;
combo_continue = 0;
Posted By: WoYoSensei

Re: Kingdom Hearts Movement - LMB & RMB combo - 10/18/09 09:59

It`s working but... not working... I mean, it`s working only when I hold one of mouse button and one of movement keys after second animation - punch_b. But it`s not working anyway... pls help. I`m stuck...
Posted By: Ottawa

Re: Kingdom Hearts Movement - LMB & RMB combo - 10/18/09 14:14

Hi!

Are you using all the code that is posted?
Are you trying to modify it?

My suggestion is to make the code work before you try to modify it?
Posted By: WoYoSensei

Re: Kingdom Hearts Movement - LMB & RMB combo - 10/18/09 15:54

No, no, no. I give you the link in my first post. This is Original Kingdom Hearts Movement code converted from A6 to A7. Here is the link: http://www.coniserver.net/wiki/index.php/Original_Kingdom_Hearts_Movement
Posted By: WoYoSensei

Re: Kingdom Hearts Movement - LMB & RMB combo - 10/22/09 15:21

Anybody can help me resolve this problem?
Posted By: AlexH

Re: Kingdom Hearts Movement - LMB & RMB combo - 10/22/09 21:19

I think before you try to resolve this silly little "problem" you're having you should first understand the code you're trying to modify. Try to rebuild the Movement system in your own project, for two reasons:

1.) You'll know exactly how it works because you made it and won't have to ask everyone else for help every time you come to a problem with modifying it.

2.) The given Movement example is coded rather poorly not to mention slightly outdated functions/variables used in it.
© 2024 lite-C Forums