4
0
Fork 0
This commit is contained in:
sOlaris38 2020-12-05 16:34:01 +01:00
commit ce95876b6d
3 changed files with 96 additions and 66 deletions

View file

@ -0,0 +1,30 @@
// Attaque au corp à corp
//jouer l'animation
tailleEpee = 20; // à définir
switch (image_index) {
case 0:
inst = collision_rectangle(x+5, y+tailleEpee, x-5, y+tailleEpee, oMonster, true, oPlayer);
break;
case 1:
inst = collision_rectangle(x+tailleEpee, y+5, x+tailleEpee, y-5, oMonster, true, oPlayer);
break;
case 2:
inst = collision_rectangle(x+5, y-tailleEpee, x-5, y-tailleEpee, oMonster, true, oPlayer);
break;
case 3:
inst = collision_rectangle(x-tailleEpee, y+5, x-tailleEpee, y-5, oMonster, true, oPlayer);
break;
default:
inst = noone;
}
if (inst != noone) {
show_debug_message("objet trouvé !");
// attaque
} else {
//a supp
show_debug_message("pas d'objet...");
}

View file

@ -1,27 +1,26 @@
keyLeft = keyboard_check(vk_left) or keyboard_check(ord("Q")); keyLeft = keyboard_check(vk_left) or keyboard_check(ord("Q"));
keyRight = keyboard_check(vk_right) or keyboard_check(ord("D")); keyRight = keyboard_check(vk_right) or keyboard_check(ord("D"));
keyUp = keyboard_check(vk_up) or keyboard_check(ord("Z")); keyUp = keyboard_check(vk_up) or keyboard_check(ord("Z"));
keyDown = keyboard_check(vk_down) or keyboard_check(ord("S")); keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
keyAttack = keyboard_check_pressed(vk_shift);
// Déplacement du joueur
// Déplacement du joueur
deplaceHorizontal = keyRight - keyLeft;
deplaceHorizontal = keyRight - keyLeft; deplaceVertical = keyDown - keyUp;
deplaceVertical = keyDown - keyUp;
x += deplaceHorizontal;
x += deplaceHorizontal; y += deplaceVertical;
y += deplaceVertical;
seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
// Animation des sprites
// Animation des sprites
if (seDeplace) {
if (seDeplace) { if (deplaceHorizontal = 0) {
if (deplaceHorizontal = 0) { if (deplaceVertical = 1) image_index = 0;
if (deplaceVertical = 1) image_index = 0; else image_index = 2;
else image_index = 2; }
} else if (deplaceHorizontal = 1) image_index = 1;
else if (deplaceHorizontal = 1) image_index = 1; else image_index = 3;
else image_index = 3;
} }

View file

@ -1,41 +1,42 @@
{ {
"spriteId": { "spriteId": {
"name": "sPlayer", "name": "sPlayer",
"path": "sprites/sPlayer/sPlayer.yy", "path": "sprites/sPlayer/sPlayer.yy",
}, },
"solid": false, "solid": false,
"visible": true, "visible": true,
"spriteMaskId": null, "spriteMaskId": null,
"persistent": false, "persistent": false,
"parentObjectId": null, "parentObjectId": null,
"physicsObject": false, "physicsObject": false,
"physicsSensor": false, "physicsSensor": false,
"physicsShape": 1, "physicsShape": 1,
"physicsGroup": 1, "physicsGroup": 1,
"physicsDensity": 0.5, "physicsDensity": 0.5,
"physicsRestitution": 0.1, "physicsRestitution": 0.1,
"physicsLinearDamping": 0.1, "physicsLinearDamping": 0.1,
"physicsAngularDamping": 0.1, "physicsAngularDamping": 0.1,
"physicsFriction": 0.2, "physicsFriction": 0.2,
"physicsStartAwake": true, "physicsStartAwake": true,
"physicsKinematic": false, "physicsKinematic": false,
"physicsShapePoints": [], "physicsShapePoints": [],
"eventList": [ "eventList": [
{"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
{"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",}, {"isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
], {"isDnD":false,"eventNum":74,"eventType":9,"collisionObjectId":null,"parent":{"name":"oPlayer","path":"objects/oPlayer/oPlayer.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMEvent",},
"properties": [ ],
{"varType":1,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"deplaceHorizontal","tags":[],"resourceType":"GMObjectProperty",}, "properties": [
{"varType":1,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"deplaceVertical","tags":[],"resourceType":"GMObjectProperty",}, {"varType":1,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"deplaceHorizontal","tags":[],"resourceType":"GMObjectProperty",},
{"varType":0,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"spriteDir","tags":[],"resourceType":"GMObjectProperty",}, {"varType":1,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"deplaceVertical","tags":[],"resourceType":"GMObjectProperty",},
], {"varType":0,"value":"0","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"spriteDir","tags":[],"resourceType":"GMObjectProperty",},
"overriddenProperties": [], ],
"parent": { "overriddenProperties": [],
"name": "Entity", "parent": {
"path": "folders/Objects/Entity.yy", "name": "Entity",
}, "path": "folders/Objects/Entity.yy",
"resourceVersion": "1.0", },
"name": "oPlayer", "resourceVersion": "1.0",
"tags": [], "name": "oPlayer",
"resourceType": "GMObject", "tags": [],
"resourceType": "GMObject",
} }