commit b2bfa5a60775006ec139c131915d31d264232ee2
parent 678fa487e6f8f3ffbb7645b0f3f4fc8d9cde8ec9
Author: Claudio Alessi <smoppy@gmail.com>
Date: Tue, 26 Jun 2018 20:12:01 +0200
Make zombies trying to avoid cannon balls.
Also fix an out-of-map issue on level 5.
Diffstat:
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/globox.c b/globox.c
@@ -752,6 +752,7 @@ walkright(const Arg *arg) {
int
zombie(Object *o) {
+ Arg arg;
Block *b, *p;
int t;
@@ -766,11 +767,20 @@ zombie(Object *o) {
/* walk (maybe) */
if(DELAY(b, DelayZombie, 4))
continue;
+ /* detect near cannon balls */
+ for(p = scene->blocks; p; p = p->next)
+ if(p->o->ontick == cannonball && p->y == b->y
+ && p->x >= b->x - 3 && p->x <= b->x + 3)
+ break;
+ if(p) {
+ arg.v = b->o;
+ jump(&arg);
+ }
t = rand() % 3;
if(t == 2)
t = -1;
if(t)
- objwalk(b->o, t);
+ walk(b, t);
}
return 0;
}
diff --git a/levels.h b/levels.h
@@ -50,7 +50,7 @@ char lev5[] = {
"| _ |\n"
"| |\n"
"| # |____\n"
- "| _ |\n"
+ "| x _ |\n"
"t |\n"
"| j\n"
"t _ |\n"
@@ -66,7 +66,7 @@ char lev5[] = {
"| |\n"
"| |\n"
"| _ |\n"
- "| |________\n"
+ "| |||||||||\n"
"t________________)"
};