Ajout de l'animation lors des déplacements du joueur
This commit is contained in:
parent
9e7fdc05f4
commit
75320e30dd
3 changed files with 25 additions and 6 deletions
|
@ -1,3 +1,6 @@
|
||||||
seDeplace = 0;
|
seDeplace = 0;
|
||||||
pdv = 100;
|
pdv = 100;
|
||||||
inv = 0; //timer invinsiblité
|
inv = 0; //timer invinsiblité
|
||||||
|
|
||||||
|
indexImageInfo = 0;
|
||||||
|
compteurFrames = 0;
|
|
@ -24,10 +24,25 @@ seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
|
||||||
// Animation des sprites
|
// Animation des sprites
|
||||||
|
|
||||||
if (seDeplace) {
|
if (seDeplace) {
|
||||||
|
sprite_index = sPlayerRun;
|
||||||
|
//image_speed = 1;
|
||||||
if (deplaceHorizontal = 0) {
|
if (deplaceHorizontal = 0) {
|
||||||
if (deplaceVertical = 1) image_index = 0;
|
if (deplaceVertical = 1) {
|
||||||
else image_index = 2;
|
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;
|
compteurFrames++;
|
||||||
else image_index = 3;
|
} else {
|
||||||
|
sprite_index = sPlayer;
|
||||||
|
image_index = indexImageInfo;
|
||||||
}
|
}
|
|
@ -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":"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":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":"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": [],
|
"overriddenProperties": [],
|
||||||
"parent": {
|
"parent": {
|
||||||
|
|
Reference in a new issue