- [+] plants now shoot upwards if you are above and near (similar to
spider drop code) - [+] projectile is vertical fireball - [+] use code similar to snake - [+] only allowed to shoot if s->bullet = null - [+] always use open mouth frame if s->bullet - [+] bullet has initial negative y velocity and is affected by gravity - [+] once it is lower than its initial y point, it dies.... - [+] ...and update owner->bullet = null
This commit is contained in:
parent
3a269817f0
commit
d9963652c8
49
rc.c
49
rc.c
|
@ -3448,6 +3448,14 @@ int movesprite(sprite_t *s) {
|
|||
// die
|
||||
s->dead = D_FINAL;
|
||||
}
|
||||
} else if (s->id == P_FIREUP) { // vertical fireball
|
||||
s->y = s->y + s->ys;
|
||||
s->ys += 0.1;
|
||||
// if lower than starting y position & moving down
|
||||
if ((s->y >= s->timer1) && (s->ys > 0)) {
|
||||
// die
|
||||
s->dead = D_FINAL;
|
||||
}
|
||||
} else if ((s->id == P_METEOR) || (s->id == P_FALLINGBRICK)) { // meteor
|
||||
double oldy;
|
||||
|
||||
|
@ -4265,8 +4273,49 @@ int movesprite(sprite_t *s) {
|
|||
rv = movex(s, s->dir*getspeed(s), B_TRUE);
|
||||
}
|
||||
} else if (s->id == P_PLANT) {
|
||||
/* timer1 loopsfrom 0 - 19
|
||||
|
||||
if timer1 is 0, we can shoot. if it is 1, we can't.
|
||||
|
||||
*/
|
||||
|
||||
// don't move!
|
||||
s->moved = MV_WALK;
|
||||
|
||||
|
||||
if (!s->falling) {
|
||||
int xdiff, absxdiff;
|
||||
sprite_t *pp;
|
||||
|
||||
/* distance to player */
|
||||
xdiff = getxdisttoplayer(s, &pp);
|
||||
if (pp) {
|
||||
absxdiff = abs(xdiff);
|
||||
|
||||
if (!s->bullet) {
|
||||
if (s->timer1 == 0) {
|
||||
if ((pp->y < s->y) && (absxdiff <= (TILEW*3)) ) {
|
||||
sprite_t *ss;
|
||||
ss = addsprite(P_FIREUP,s->x,s->y - TILEH,"fireup" );
|
||||
ss->ys = -4;
|
||||
ss->xs = 0;
|
||||
ss->dir = s->dir;
|
||||
|
||||
ss->owner = s;
|
||||
s->bullet = ss;
|
||||
|
||||
// remember our starting y pos.
|
||||
ss->timer1 = ss->y;
|
||||
|
||||
// reset out shoot timer
|
||||
s->timer1 = 75;
|
||||
}
|
||||
} else {
|
||||
s->timer1--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (s->id == P_KINGRAT) {
|
||||
/* timer1 is state
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
for f in /tmp/level*.bmp ; do
|
||||
newname=/tmp/`basename $f .bmp`.png
|
||||
convert $f -geometry 160x120 ${newname}
|
||||
echo "done $newname."
|
||||
done
|
18
shared.c
18
shared.c
|
@ -2193,6 +2193,22 @@ void drawsprite(sprite_t *s) {
|
|||
} else if (s->id == P_FALLINGBRICK) {
|
||||
// only 1 frame
|
||||
frame = F_WALK1;
|
||||
} else if (s->id == P_FIREUP) {
|
||||
if (s->ys < 0) {
|
||||
// going up
|
||||
if ((timer/6) % 2 == 0) {
|
||||
frame = F_WALK1;
|
||||
} else {
|
||||
frame = F_JUMP;
|
||||
}
|
||||
} else {
|
||||
// going down
|
||||
if ((timer/6) % 2 == 0) {
|
||||
frame = F_FALL;
|
||||
} else {
|
||||
frame = F_CAUGHT;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((timer/6) % 2 == 0) {
|
||||
frame = F_WALK1;
|
||||
|
@ -2386,6 +2402,8 @@ void drawsprite(sprite_t *s) {
|
|||
} else {
|
||||
frame = F_SLAM5;
|
||||
}
|
||||
} else if ((s->id == P_PLANT) && s->bullet) { //shooting plant
|
||||
frame = F_JUMP; // ie. mouth open
|
||||
} else if (!s->teleporting) {
|
||||
if ((s->id == P_SPIDER) && (s->ys != -99)) {
|
||||
frame = F_FALL;
|
||||
|
|
Loading…
Reference in New Issue