prettier rat tail

This commit is contained in:
Ondřej Hruška
2014-05-01 16:09:19 +02:00
parent b07ff07688
commit 65efbe33da
10 changed files with 19 additions and 5 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
View File
Binary file not shown.
+2 -1
View File
@@ -76,9 +76,10 @@ public final class Res {
textures.addQuad("panel", gui.makeQuad(0, 3.75, 4, .25)); textures.addQuad("panel", gui.makeQuad(0, 3.75, 4, .25));
// sprites // sprites
texture = textures.loadTexture("mob", "/res/img/dudes-b.png", FilterMode.NEAREST, WrapMode.CLAMP); texture = textures.loadTexture("mob", "/res/img/dudes.png", FilterMode.NEAREST, WrapMode.CLAMP);
tiles = texture.grid(8, 8); tiles = texture.grid(8, 8);
textures.addSheet("sprite.player", tiles.makeSheet(0, 0, 4, 1)); textures.addSheet("sprite.player", tiles.makeSheet(0, 0, 4, 1));
textures.addSheet("sprite.rat", tiles.makeSheet(0, 1, 4, 1));
// small sheet // small sheet
texture = textures.loadTexture("tiles", "/res/img/tiles16.png", FilterMode.NEAREST, WrapMode.CLAMP); texture = textures.loadTexture("tiles", "/res/img/tiles16.png", FilterMode.NEAREST, WrapMode.CLAMP);
@@ -151,7 +151,9 @@ public abstract class Entity implements IonObjBundled, Updateable {
@DefaultImpl @DefaultImpl
public final void render(MapRenderContext context) public final void render(MapRenderContext context)
{ {
getRenderer().render(context); if (context.getTile(getCoord()).isExplored()) {
getRenderer().render(context);
}
} }
@@ -116,4 +116,10 @@ public class PlayerEntity extends Entity {
{ {
return EntityType.PLAYER; return EntityType.PLAYER;
} }
@Override
public void receiveAttack(Entity attacker, int attackStrength)
{
// FIXME ignore attack
}
} }
@@ -53,7 +53,7 @@ public class RatEntity extends Entity {
protected EntityRenderer getRenderer() protected EntityRenderer getRenderer()
{ {
if (renderer == null) { if (renderer == null) {
renderer = new EntityRendererMobLR(this, "sprite.player"); renderer = new EntityRendererMobLR(this, "sprite.rat");
} }
return renderer; return renderer;
@@ -44,7 +44,7 @@ public class EntityRendererMobLR extends EntityRenderer {
final Vect visualPos = entity.pos.getVisualPos(); final Vect visualPos = entity.pos.getVisualPos();
Rect spriteRect = Rect.make(visualPos.x() * w, visualPos.y() * w, w, w); Rect spriteRect = Rect.make(visualPos.x() * w, visualPos.y() * w, w, w);
spriteRect = spriteRect.shrink(w * 0.1); spriteRect = spriteRect.shrink(w * 0.05);
Render.quadTextured(spriteRect, q); Render.quadTextured(spriteRect, q);
} }
@@ -45,7 +45,7 @@ public class LevelGenerator {
// spawn rats // spawn rats
final Coord pos = Coord.make(0, 0); final Coord pos = Coord.make(0, 0);
for (int i = 0; i < 1; i++) { // 4+complexity + rand.nextInt(1+complexity) for (int i = 0; i < 4+complexity + rand.nextInt(1+complexity); i++) {
final Entity e = Entities.RAT.createEntity(world); final Entity e = Entities.RAT.createEntity(world);
@@ -5,6 +5,7 @@ import mightypork.gamecore.util.math.algo.Coord;
import mightypork.gamecore.util.math.constraints.rect.Rect; import mightypork.gamecore.util.math.constraints.rect.Rect;
import mightypork.gamecore.util.math.constraints.rect.builders.TiledRect; import mightypork.gamecore.util.math.constraints.rect.builders.TiledRect;
import mightypork.rogue.world.level.MapAccess; import mightypork.rogue.world.level.MapAccess;
import mightypork.rogue.world.tile.Tile;
public abstract class MapRenderContext { public abstract class MapRenderContext {
@@ -33,4 +34,8 @@ public abstract class MapRenderContext {
{ {
return mapRect; return mapRect;
} }
public Tile getTile(Coord pos) {
return map.getTile(pos);
}
} }