40 lines
No EOL
816 B
Text
40 lines
No EOL
816 B
Text
// deplacement monstre
|
|
|
|
if (touche == 0) {
|
|
if dureeDeplacement != 0 {
|
|
x += deplaceHorizontal;
|
|
y += deplaceVertical;
|
|
dureeDeplacement --;
|
|
}
|
|
else {
|
|
deplaceHorizontal = 0;
|
|
deplaceVertical = 0;
|
|
dir = irandom(3);
|
|
switch(dir) {
|
|
case 0 : deplaceVertical = 1; break;
|
|
case 1 : deplaceHorizontal = 1; break;
|
|
case 2 : deplaceVertical = -1; break;
|
|
case 3 : deplaceHorizontal = -1; break;
|
|
}
|
|
|
|
dureeDeplacement = 120;
|
|
}
|
|
|
|
// collision avec un mur
|
|
|
|
if place_meeting(x,y,oWall) {
|
|
if (dir > 1) dir -= 2;
|
|
else dir += 2;
|
|
|
|
switch(dir) {
|
|
case 0 : deplaceVertical = 1; break;
|
|
case 1 : deplaceHorizontal = 1; break;
|
|
case 2 : deplaceVertical = -1; break;
|
|
case 3 : deplaceHorizontal = -1; break;
|
|
}
|
|
|
|
dureeDeplacement = 120;
|
|
}
|
|
} else {
|
|
touche--;
|
|
} |