Jeu développé lors de la Yogscast Game Jam 2020. https://solaris38.itch.io/surprise-dungeon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

61 lines
1.7 KiB

keyLeft = keyboard_check(vk_left) or keyboard_check(ord("Q")) or keyboard_check(ord("A"));
keyRight = keyboard_check(vk_right) or keyboard_check(ord("D"));
keyUp = keyboard_check(vk_up) or keyboard_check(ord("Z")) or keyboard_check(ord("W"));
keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
// Déplacement du joueur
depth = -bbox_bottom;
deplaceHorizontal = keyRight - keyLeft;
deplaceVertical = keyDown - keyUp;
if (isAttack) {
sprite_index = sPlayerAttackSlash;
image_speed = 1.5;
if (compteurFrames == 0) {
image_index = indexImageInfo * 4;
} else if (compteurFrames > 4) {
isAttack = false;
}
compteurFrames += 0.5;
} else {
if ((deplaceHorizontal > 0 && !place_meeting(x+2, y, oWall))
|| (deplaceHorizontal < 0 && !place_meeting(x-2, y, oWall))) {
x += deplaceHorizontal*spd;
}
if ((deplaceVertical > 0 && !place_meeting(x, y+2, oWall))
|| (deplaceVertical < 0 && !place_meeting(x, y-2, oWall))) {
y += deplaceVertical*spd;
}
seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
// Animation des sprites
if (seDeplace) {
sprite_index = sPlayerRun;
//image_speed = 1;
if (deplaceHorizontal = 0) {
if (deplaceVertical = 1) {
image_index = compteurFrames % nbFrames;
indexImageInfo = 0;
} else {
image_index = compteurFrames % nbFrames + 2 * nbFrames;
indexImageInfo = 2;
}
} else if (deplaceHorizontal = 1) {
indexImageInfo = 1;
image_index = compteurFrames % nbFrames + nbFrames;
} else {
indexImageInfo = 3;
image_index = compteurFrames % nbFrames + 3*nbFrames;
}
compteurFrames += 0.25*spd;
} else {
sprite_index = sPlayer;
image_index = indexImageInfo;
}
}