41 lines
No EOL
839 B
Text
41 lines
No EOL
839 B
Text
// deplacement monstre
|
|
depth = -bbox_bottom;
|
|
|
|
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--;
|
|
} |