Here I am with another problem..this one really pisses me off and since I tried everything but wasn't able to solve it, I decided to post here in hope that some of you may help me.
Okay, lets get started:
Im making a beat-em-up game with some basic functions such as Left,Right,Up and some other letters.. Now, Ive made a keypress event (Z) which is supposed to change into another sprite (Punch). The thing is, when I first start the game, then i would be able to do it, meaning, sprite WOULD change and the button would respond. But right after I make a right move, after I move to the right or use the right key, then it would somehow block my Z key and I wouldn't be able to do it again. But if I turned to the left, (if I used the left key), then my punch animation would work. So clearly, something is blocking my sprite changing action on Z key with walking action on keypress right. But what? I tried to find it but I dont see anything thats causing this issue.
Here is the code of my Keyboard event right:
if keyboard_check(vk_left) then exit
scaleX = 1
if(attack=0)
if(set=1)
{
time=time+1
if(time/5 && time<50)
{
hspeed=hspeed+0.1
image_speed=image_speed+0.0025
}
}
if(delaycon=1 && set=0 && dusttimer=0)
{
if not(walkingcon=1)
delay=delay+1
sprite_index = Switch
image_xscale = scaleX
if(delay>5 && delay<10)
{
image_xscale = scaleX
}
if(delay>10){
hspeed=0
walkingcon=1
time=1
set=1
delay=0
hspeed=4
sprite_index = run_Left_right
image_xscale = scaleX
image_speed=0.05;
delaycon=0
}
}
background_hspeed[0]= 0.1;
background_hspeed[1]= 0.2;
background_hspeed[2]= 0.3;
background_hspeed[3]= 0.5;
background_hspeed[4]= 0;
And here is the code of my Key Press event right
if walkingcon != 0 then exit
if delay != 0 then exit
if keyboard_check(vk_left) then exit
if(attack=0)
if(hspeed=0)
if not(keyboard_check(vk_left))
if not(walkingcon=2)
{
walkingcon=1
time=1
set=1
hspeed=2
sprite_index = run_Left_right
image_xscale = scaleX
image_speed=0.05;
}
delay=0
if(hspeed<0.2)
if(walkingcon=2)
{
delaycon=1
}
scaleX = 1Im also going to provide my step event to you, since im using it with the movement actions to speed up my character, it may come in handy.
if(walkingcon=2)
time=time+1
if(attack=0)
{
if(set=0)
{
if(time/5 && walkingcon=2)
{
hspeed=hspeed+0.1
}
if (hspeed>0.2)
{
walkingcon=0
sprite_index = stand_left_right
image_xscale = scaleX
image_speed = 0.1
hspeed=0
time=0
}
}
if(set=1)
{
if(time/5 && walkingcon=2)
{
hspeed=hspeed-0.1
}
if (hspeed<0.2)
{
walkingcon=0
sprite_index = stand_left_right
image_xscale = scaleX
image_speed = 0.1
hspeed=0
time=0
}
}
}
And for the key press event Z, its just an sprite changing action.
Please, if you can figure this out, post below i really need it, and i need it fast.
Thanks a lot in advance!!!
Cheers!
Edited by OzzyEx, 11 February 2012 - 12:38 PM.











