Include transparent overlay selection tile

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 3 years ago
parent bdc22767f5
commit 3a23fd23ea
  1. 3
      src/sig/engine/Object.java
  2. 1
      src/sig/map/Tile.java
  3. 6
      src/sig/objects/LevelRenderer.java
  4. BIN
      tiles.png

@ -47,6 +47,9 @@ public abstract class Object implements GameEntity{
this.spr = spr; this.spr = spr;
} }
public void drawOverlay(int[] p) {
}
protected void Draw_Sprite(double x, double y, Sprite sprite){ protected void Draw_Sprite(double x, double y, Sprite sprite){
DrawLoop.Draw_Sprite(x,y,sprite); DrawLoop.Draw_Sprite(x,y,sprite);
} }

@ -6,6 +6,7 @@ public enum Tile {
FLOOR(1,0), FLOOR(1,0),
PLATFORM_LEDGE(2,0), PLATFORM_LEDGE(2,0),
INVISIBLE_WALL(0,0,true), INVISIBLE_WALL(0,0,true),
HIGHLIGHTED_TILE(3,0),
; ;
final public static int TILE_WIDTH=32; final public static int TILE_WIDTH=32;

@ -32,13 +32,13 @@ public class LevelRenderer extends Object{
public void draw(int[] p) { public void draw(int[] p) {
for (int y=(int)(0+this.getY()/Tile.TILE_HEIGHT);y<(int)(RabiClone.BASE_HEIGHT/Tile.TILE_HEIGHT+this.getY()/Tile.TILE_HEIGHT+1);y++) { for (int y=(int)(0+this.getY()/Tile.TILE_HEIGHT);y<(int)(RabiClone.BASE_HEIGHT/Tile.TILE_HEIGHT+this.getY()/Tile.TILE_HEIGHT+1);y++) {
for (int x=(int)(0+this.getX()/Tile.TILE_WIDTH);x<(int)(RabiClone.BASE_WIDTH/Tile.TILE_WIDTH+this.getX()/Tile.TILE_WIDTH+1);x++) { for (int x=(int)(0+this.getX()/Tile.TILE_WIDTH);x<(int)(RabiClone.BASE_WIDTH/Tile.TILE_WIDTH+this.getX()/Tile.TILE_WIDTH+1);x++) {
if (x==RabiClone.p.highlightedSquare.getX()&&y==RabiClone.p.highlightedSquare.getY()) {
DrawTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),Tile.WALL);
}
if (RabiClone.CURRENT_MAP.getTile(x,y)!=Tile.VOID) { if (RabiClone.CURRENT_MAP.getTile(x,y)!=Tile.VOID) {
DrawTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),RabiClone.CURRENT_MAP.getTile(x,y)); DrawTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),RabiClone.CURRENT_MAP.getTile(x,y));
//System.out.println((x*Tile.TILE_WIDTH+(this.getX()%Tile.TILE_WIDTH) )+","+(y*Tile.TILE_HEIGHT+(this.getY()%Tile.TILE_HEIGHT))); //System.out.println((x*Tile.TILE_WIDTH+(this.getX()%Tile.TILE_WIDTH) )+","+(y*Tile.TILE_HEIGHT+(this.getY()%Tile.TILE_HEIGHT)));
} }
if (x==RabiClone.p.highlightedSquare.getX()&&y==RabiClone.p.highlightedSquare.getY()) {
DrawTile(x*Tile.TILE_WIDTH-this.getX(),y*Tile.TILE_HEIGHT-this.getY(),Tile.HIGHLIGHTED_TILE);
}
} }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 5.7 KiB

Loading…
Cancel
Save