4
0
Fork 0

Ajout de l'animation lors des déplacements du joueur

This commit is contained in:
rick 2020-12-05 22:26:40 +01:00
parent 9e7fdc05f4
commit 75320e30dd
3 changed files with 25 additions and 6 deletions

View file

@ -1,3 +1,6 @@
seDeplace = 0;
pdv = 100;
inv = 0; //timer invinsiblité
indexImageInfo = 0;
compteurFrames = 0;

View file

@ -24,10 +24,25 @@ 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 = 0;
else image_index = 2;
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;
}
else if (deplaceHorizontal = 1) image_index = 1;
else image_index = 3;
compteurFrames++;
} else {
sprite_index = sPlayer;
image_index = indexImageInfo;
}

View file

@ -31,6 +31,7 @@
{"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":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",},
{"varType":0,"value":"8","rangeEnabled":false,"rangeMin":0.0,"rangeMax":10.0,"listItems":[],"multiselect":false,"filters":[],"resourceVersion":"1.0","name":"nbFrames","tags":[],"resourceType":"GMObjectProperty",},
],
"overriddenProperties": [],
"parent": {