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
708 B
Text
Raw Normal View History

2020-12-05 16:33:57 +01:00
// deplacement monstre
if dureeDeplacement != 0 {
x += deplaceHorizontal;
2020-12-05 16:41:46 +01:00
y += deplaceVertical;
2020-12-05 16:33:57 +01:00
dureeDeplacement --;
}
else {
2020-12-05 17:07:07 +01:00
deplaceHorizontal = 0;
deplaceVertical = 0;
dir = irandom(3);
2020-12-05 16:33:57 +01:00
switch(dir) {
2020-12-05 17:07:07 +01:00
case 0 : deplaceVertical = 1; break;
case 1 : deplaceHorizontal = 1; break;
case 2 : deplaceVertical = -1; break;
case 3 : deplaceHorizontal = -1; break;
2020-12-05 16:33:57 +01:00
}
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;
}