Added new monster: frog

This commit is contained in:
Rob Pearce 2008-12-22 03:03:48 +00:00
parent 0fbde13339
commit a1ee548188
16 changed files with 173 additions and 38 deletions

View File

@ -33,17 +33,17 @@ monsters
17 4 28
15 34 28
15 23 28
6 6 27
49 13 21
49 32 8
49 11 11
49 33 17
60 28 13
60 31 24
60 11 16
60 7 8
6 35 0
6 17 3
60 28 13
60 11 16
157 6 27
157 17 6
157 35 8
endmonsters
exitdir 2
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,

View File

@ -46,12 +46,12 @@ monsters
15 16 5
15 14 5
6 5 11
18 31 14
18 26 5
18 9 23
49 28 23
157 9 23
157 24 14
157 31 5
124 24 5
124 15 5
124 17 5
endmonsters
exitdir 1
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,

View File

@ -10,8 +10,6 @@ monsters
12 34 14
12 4 14
60 22 13
124 15 19
124 24 19
49 32 5
49 7 5
1 32 22
@ -42,6 +40,8 @@ monsters
17 4 2
17 5 25
17 34 25
157 24 19
157 15 16
endmonsters
exitdir 1
44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,

View File

@ -28,10 +28,11 @@ monsters
15 33 19
15 24 8
15 23 8
132 19 6 312 112 312 442
132 19 6 312 112 312 112 312 442
15 18 5
15 20 5
16 19 5
157 35 6
endmonsters
exitdir 1
61,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,61,

View File

@ -7,14 +7,11 @@ monsters
0 6 28
134 33 28
23 20 4
12 31 20
12 21 16
12 24 8
12 6 12
12 12 24
6 28 2
6 9 3
49 21 28
16 14 20
16 16 20
16 18 20
@ -52,6 +49,10 @@ monsters
16 31 4
16 30 4
16 29 4
157 22 28
157 17 28
12 31 20
12 6 12
endmonsters
exitdir 1
61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,61,

View File

@ -4,12 +4,11 @@ hurryup 30
help
endhelp
monsters
0 5 23
134 35 22
23 12 19
0 35 19
134 36 19
23 38 19
6 20 10
133 18 19
133 26 19
157 3 18
endmonsters
exitdir 1
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
@ -31,13 +30,13 @@ exitdir 1
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,17,0,0,0,0,0,17,0,0,0,0,0,17,0,0,0,0,0,17,0,0,0,0,17,0,0,0,0,0,0,0,4,
4,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,
4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,1,1,1,1,1,4,
4,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,1,1,1,1,1,1,4,
4,0,0,0,0,0,0,0,0,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4,
4,0,0,0,0,0,0,0,0,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4,
4,0,0,0,0,0,0,0,0,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4,
4,0,0,0,1,1,1,1,1,1,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4,
4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,1,1,1,1,1,1,4,
4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,0,0,0,0,0,4,
4,0,0,0,0,0,0,0,0,4,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4,0,0,0,0,0,4,
4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,

BIN
data/sprites/frog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
data/sprites/frogcaught.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/sprites/frogdead.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/sprites/frogfall.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/sprites/frogjump.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

11
defs.h
View File

@ -193,6 +193,10 @@
#define ICESPEED 2 // how fast a level turns to ice
#define MONJUMPSPEED 5 // how high monsters jump
#define FROGJUMPSPEED1 3 // how high frogs jump
#define FROGJUMPSPEED2 6 // how high frogs jump
#define FROGPAUSE 20 // how long frog waits in between jumps
#define BOMBSHAKETIME 100 // time for screen will shake after a bomb
#define RATSHAKETIME 50 // shake time when king rat is stunned
@ -301,6 +305,10 @@
#define B_TRUE -1
#define B_FALSE 0
// reasons for not being able to move
#define NM_SIDE -1
#define NM_BELOW -2
// fruit types
#define FT_FRUIT 1
#define FT_PERM 2
@ -408,7 +416,7 @@
#define S_SLOPE 2
// Sprite types
#define MAXPTYPES 157
#define MAXPTYPES 158
#define P_PLAYER 0
#define P_RAT 1
#define P_CHEESE 2
@ -571,6 +579,7 @@
#define P_PILL 154
#define P_RAYGUN 155
#define P_RAYGUNBULLET 156
#define P_FROG 157
#define FLY_FLYTIME 150

123
rc.c
View File

@ -1437,6 +1437,22 @@ void jump(sprite_t *s, int dir) {
// jump right away
s->jumpspeed = MONJUMPSPEED; // will be changed later
s->jumping = 1;
} else if (s->id == P_FROG) {
sprite_t *whoabove;
whoabove = isplayerabove(s);
if (whoabove) {
double ydis;
ydis = abs(s->y - whoabove->y);
if (ydis <= (TILEH*5)) {
s->jumpspeed = MONJUMPSPEED; // normal jump
} else {
s->jumpspeed = FROGJUMPSPEED2; // very high
}
} else {
s->jumpspeed = FROGJUMPSPEED1; // ie not high enough for most platforms
}
s->jumping = 1;
} else {
// delay then jump
s->jumptimer = getjumpdelay(s->id);
@ -2512,7 +2528,22 @@ int movesprite(sprite_t *s) {
}
} else if (s->jumping) {
if (s->id != P_KINGRAT) {
movex(s, s->jumpdir*getspeed(s), B_TRUE);
int rv;
rv = movex(s, s->jumpdir*getspeed(s), B_TRUE);
// frogs bounce off walls
/*
if (s->id == P_FROG) {
if (rv == NM_SIDE) {
if (!isongroundpoint(s,s->x,s->y - (TILEH/2))) {
if (!isroofabove(s)) {
s->dir = -s->dir;
s->jumpdir = -s->jumpdir;
}
}
}
}
*/
}
return B_FALSE;
}
@ -2658,6 +2689,11 @@ int movesprite(sprite_t *s) {
newsp = addsprite(s->timer3, s->x,s->y,s->name );
if (s->timer3 == P_FROG) {
// so all frogs don't jump at once.
newsp->timer3 = (rand() % FROGPAUSE);
}
// is it a boss? if so update boss pointer
switch (s->timer3) {
case P_KINGRAT:
@ -3191,6 +3227,74 @@ int movesprite(sprite_t *s) {
movex(s, s->jumpdir*getspeed(s), B_TRUE);
}
}
} else if (s->id == P_FROG) {
if (isinwater(s)) {
// move like a fish
double absxs,absys;
s->flies = B_TRUE;
s->falling = B_FALSE;
if ((s->xs == -99) || (s->ys == -99)) {
s->xs = getspeed(s) * s->dir;
s->ys = getspeed(s);
}
if (s->xs > 0) absxs = 1;
else absxs = -1;
if (s->ys > 0) absys = 1;
else absys = -1;
/* can we move? */
tt = gettileat(s->x + (s->dir * ((s->img->w/2)+3)) + s->xs , s->y-(s->img->h/2),NULL,NULL);
if ((tt->solid) || (tt->spikes )) {
/* turn */
s->xs = -s->xs;
}
tt = gettileat(s->x, s->y-(s->img->h/2) + s->ys,NULL,NULL);
if ((tt->solid) || (tt->spikes) ) {
/* turn */
s->ys = -s->ys;
} else if (!tt->water) {
s->flies = B_FALSE;
// exit water
jump(s, s->dir);
// force big jump
s->jumpspeed = FROGJUMPSPEED2;
}
/* move */
s->x += s->xs;
s->y += s->ys;
s->dir = absxs;
s->moved = MV_WALK;
} else {
// for if we get back in the water
s->xs = -99;
s->ys = -99;
s->flies = B_FALSE;
// timer3 used for pause inbetween jump
if ((!s->falling) && (!s->jumping)) {
if (s->timer3) {
s->timer3--;
} else {
// jump forwards
jump(s, s->dir);
s->timer3 = FROGPAUSE;
}
} else { // falling
int rv;
// move forwards
rv = movex(s, s->dir*getspeed(s), B_TRUE);
if (rv == NM_SIDE) { // bounce off walls
/* if we couldn't move (hit a wall), turn */
s->dir = -s->dir;
}
}
}
} else if (s->id == P_SLUG) {
if (!s->falling) {
int move = B_FALSE;
@ -3262,9 +3366,7 @@ int movesprite(sprite_t *s) {
ydiff = 999;
}
if (isplayerabove(s) && (ydiff >= (TILEH*4)) && (ydiff <= (TILEH*8))) { // player between 4 and 8 tiles above
if (xdiff <= (TILEW*8)) { // if closeish horizontally
/* jump up */
jump(s, 0);
@ -5686,6 +5788,9 @@ double getspeed(sprite_t *s ) {
if (s->jumping) {
speed = 8; // very fast jumping
}
} else if (id == P_FROG) {
if (s->angry) speed = 1.5;
else speed = 1;
} else if (id == P_RAT) {
if (s->angry) speed = 1.5;
else speed = 1;
@ -5713,7 +5818,7 @@ double getspeed(sprite_t *s ) {
speed = PLATFORM_MAXSPEED;
}
if (isinwater(s) && (s->id != P_FISH)) {
if (isinwater(s) && (s->id != P_FISH) && (s->id != P_FROG)) {
if (!s->hasmask) {
speed /= 2;
}
@ -7377,11 +7482,11 @@ int movex(sprite_t *s,double amt,int onpurpose) {
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
if (tt2->solid == S_SOLID) {
s->xs = 0;
return B_TRUE;
return NM_SIDE;
}
if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) {
s->xs = 0;
return B_TRUE;
return NM_SIDE;
}
}
@ -7392,11 +7497,11 @@ int movex(sprite_t *s,double amt,int onpurpose) {
tt2 = gettileat(newx,newy,&newtilex,&newtiley);
if (tt2->solid == S_SOLID) {
//s->xs = 0;
return B_TRUE;
return NM_BELOW;
}
if (tt2->solid == S_SLOPE && (!candoslopes(s->id))) {
//s->xs = 0;
return B_TRUE;
return NM_BELOW;
}
}
@ -7427,7 +7532,7 @@ int movex(sprite_t *s,double amt,int onpurpose) {
domove = B_FALSE;
if (tt2->solid == S_SOLID) {
// s->xs = 0;
return B_TRUE;
return NM_SIDE;
} else if ((tt2->solid == S_SLOPE) && candoslopes(s->id)) {
/* we can move, but need to adjust our height */
domove = B_TRUE;

View File

@ -762,8 +762,14 @@ void setdefaults(sprite_t *s) {
s->timer1 = 0;
}
s->timer2 = 0;
if (s->id == P_FROG) {
// so all frogs don't jump at the same time
s->timer3 = rand() % FROGPAUSE;
} else {
s->timer3 = 0;
}
s->timer4 = 0;
s->dbltimer = -1;
s->dropping = 0;
s->dropx = -1;
@ -1330,6 +1336,14 @@ int loadimagesets(void) {
/* next 3 are auto generated */
imageset[P_FLY].numimages = 8;
loadspriteimage(P_FROG,F_WALK1, "sprites/frog.png");
loadspriteimage(P_FROG,F_JUMP, "sprites/frogjump.png");
loadspriteimage(P_FROG,F_FALL, "sprites/frogfall.png");
loadspriteimage(P_FROG,F_CAUGHT, "sprites/frogcaught.png");
loadspriteimage(P_FROG,F_DEAD, "sprites/frogdead.png");
/* next 3 are auto generated */
imageset[P_FROG].numimages = 8;
loadspriteimage(P_SPIDER,F_WALK1, "sprites/newspider.png");
loadspriteimage(P_SPIDER,F_JUMP, "sprites/newspiderjump.png");
loadspriteimage(P_SPIDER,F_FALL, "sprites/newspiderfall.png");
@ -1929,10 +1943,12 @@ void drawsprite(sprite_t *s) {
SDL_Rect area;
int frame = 0;
#ifndef __EDITOR
if (isplayer(s) && s->lives < 0) {
// permenantly dead - don't draw
return;
}
#endif
// don't show caught mosnters in gunner mode
if (!isplayer(s) && (s->caughtby) ) {
@ -3025,6 +3041,7 @@ int ismonster(int id) {
case P_SNAIL:
case P_SLUG:
case P_FISH:
case P_FROG:
return MT_MONSTER;
case P_BLACKCLOUD:
case P_KINGRAT:
@ -3519,6 +3536,8 @@ void setfruitinfo(void) {
setinfo(P_SPIDER, "Spider", "Spiders will lurk quietly on the ceiling, crawling back and forth. If they notice a player nearby however they will swiftly pounce down onto their prey!", "spider.png");
setinfo(P_FROG, "Frog", "Green frogs will continually bounce around, making them more difficult to catch.", "frog.png");
setinfo(P_SNAKE, "Snake", "The snake moves in a similar fashion to the rat with one important exception - upon seeing a player they will spit a glob of deadly venom at them!", "snake.png");
setinfo(P_FLY, "Fly", "Annoying pests at the best of times, flies pose additional danger to dwarves. They fly around more erratically than bees and after landing can scurry quickly back and forth.", "fly.png");

BIN
website/img/frog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -14,6 +14,7 @@
<tr><td align=center><img src="img/fish.png"><br>Pirahna</td><td>These fish at at home in the water and unhampered by slowness while swimming.</td></tr>
<tr><td align=center><img src="img/plant.png"><br>Plant</td><td>Evil venus fly trap plants will lie in wait and devour any player foolish enough to wander into their clutches.</td></tr>
<tr><td align=center><img src="img/fly.png"><br>Fly</td><td>Annoying pests at the best of times, flies pose additional danger to dwarves. They fly around more erratically than bees and after landing can scurry quickly back and forth.</td></tr>
<tr><td align=center><img src="img/frog.png"><br>Frog</td><td>Green frogs will continually bounce around, making them more difficult to catch.</td></tr>
<tr bgcolor="#ffff00"><th colspan=2>Bosses</th></tr>
<tr><td align=center><img src="img/cloud.png"><br>Cloud of Doom</td><td>This unkillable cloud will appear if you spend too much time on one level. Beware, as the only way to defeat the cloud of doom is to complete the level before it grows too large to handle!</td></tr>
<tr><td align=center><img src="img/kingrat.png"><br>King Rat</td><td>This mighty creature is the ruler of the rats, and impervious to the player's net. It can only be harmed by slamming another monster into it! King Rat will roam the level searching for a player, and upon spotting them will charge at high speed.</td></tr>