4
0
Fork 0
This repository has been archived on 2023-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
surprise_dungeon/objects/oMonster/Step_0.gml

36 lines
No EOL
708 B
Text

// deplacement monstre
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;
}