N
niko_argento
Guest
Hi,in my top down game i created some special movement where the player moves fast from a point to another point,like Flash,for this i use Space key,but one combination doesn´t work at all and the player does not move,these are the main codes in my object player:
The problem is when i press A+W,the player does not move,the other combinations work perfect,what is my mistake here?
Code:
CREATE EVENT
//initialize variables
image_index=0;
image_speed=0;
global.walkingspeed=3;
STEP EVENT
//aiming and direction
image_angle=direction;
direction=point_direction(x,y,mouse_x,mouse_y);
//movement and animation
if keyboard_check(ord("W")) {y-=global.walkingspeed; image_speed=0.2;}
if keyboard_check(ord("S")) {y+=global.walkingspeed; image_speed=0.2;}
if keyboard_check(ord("A")) {x-=global.walkingspeed; image_speed=0.2;}
if keyboard_check(ord("D")) {x+=global.walkingspeed; image_speed=0.2;}
//stop moving and stop animation
if keyboard_check_released(ord("W")) {y-=0;image_speed=0; image_index=0;}
if keyboard_check_released(ord("S")) {y+=0;image_speed=0; image_index=0;}
if keyboard_check_released(ord("A")) {x-=0;image_speed=0; image_index=0;}
if keyboard_check_released(ord("D")) {x+=0;image_speed=0; image_index=0;}
KEY PRESS EVENT:SPACE
if global.walkingspeed > 1
{
global.walkingspeed=15;
alarm[0]=10;
}
//diagonal move
if (keyboard_check(ord("D")) && keyboard_check(ord("W"))) direction=45;
else if (keyboard_check(ord("A")) && keyboard_check(ord("W"))) direction=135;
else if (keyboard_check(ord("A")) && keyboard_check(ord("S"))) direction=225;
else if (keyboard_check(ord("S")) && keyboard_check(ord("D"))) direction=315;
ALARM 0 EVENT
global.walkingspeed=3;
image_speed=0;
image_index=0;