Display View and Tile parameters per screen instead of on an individual block. Additionally, create a system where we can load/unload active game objects

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 3 years ago
parent 3ebcae317f
commit 82f9016255
  1. 19
      src/sig/RabiClone.java
  2. 11
      src/sig/objects/EditorRenderer.java
  3. 5
      src/sig/objects/LevelRenderer.java

@ -31,7 +31,7 @@ public class RabiClone{
public static Point MOUSE_POS;
public static LevelRenderer level_renderer;
public static Player player,player2;
public static Player player;
public static Maps CURRENT_MAP = Maps.WORLD1;
public static void main(String[] args) {
@ -54,9 +54,7 @@ public class RabiClone{
f.setVisible(true);
OBJ.add(level_renderer = new LevelRenderer(p));
OBJ.add(player = new Player(p));
OBJ.add(player2 = new Player(p));
player2.setX(64);
StartGame();
p.render();
@ -70,11 +68,13 @@ public class RabiClone{
if (level_renderer instanceof EditorRenderer) {
OBJ.remove(level_renderer);
OBJ.add(level_renderer=new LevelRenderer(p));
StartGame();
}
}
if (p.KEYS.getOrDefault(KeyEvent.VK_F2,false)) {
if (!(level_renderer instanceof EditorRenderer)) {
OBJ.remove(level_renderer);
OBJ.clear();
ResetGame();
OBJ.add(level_renderer=new EditorRenderer(p));
}
}
@ -87,6 +87,15 @@ public class RabiClone{
}
}
}
private static void ResetGame() {
player=null;
}
private static void StartGame() {
OBJ.add(player = new Player(p));
}
private static void ChooseBestRatio() {
while (f.getWidth()*(SIZE_MULTIPLIER+1)<Toolkit.getDefaultToolkit().getScreenSize().getWidth()) {
SIZE_MULTIPLIER++;

@ -121,6 +121,15 @@ public class EditorRenderer extends LevelRenderer{
}
private void drawTileGrid(byte[] p, int x, int y) {
if (x%Tile.TILE_SCREEN_COUNT_X==0&&y%Tile.TILE_SCREEN_COUNT_Y==0) {
int xpos=(int)(x*Tile.TILE_WIDTH-getX());
int ypos=(int)(y*Tile.TILE_HEIGHT-getY());
int index=ypos*Map.MAP_WIDTH+xpos;
Draw_Text(xpos+2,ypos+2,
new StringBuilder("View:").append(PaletteColor.EMERALD).append(RabiClone.CURRENT_MAP.getView(x,y).ordinal())
.append(PaletteColor.NORMAL).append("\nType:").append(PaletteColor.MIDNIGHT_BLUE).append(RabiClone.CURRENT_MAP.getType(x,y).ordinal())
,Font.PROFONT_12);
}
if (x%Tile.TILE_SCREEN_COUNT_X==0) {
for (int yy=0;yy<Tile.TILE_HEIGHT;yy++) {
int ypos=(int)(y*Tile.TILE_HEIGHT-getY()+yy);
@ -152,8 +161,6 @@ public class EditorRenderer extends LevelRenderer{
double tileY = y*Tile.TILE_HEIGHT-this.getY();
DrawTransparentTile(tileX,tileY,selectedTile,Alpha.ALPHA160);
Draw_Text(tileX+2,tileY-Font.PROFONT_12.getGlyphHeight()-2,new StringBuilder(selectedTile.toString()),Font.PROFONT_12);
Draw_Text(tileX+2,tileY+2,new StringBuilder("View:").append(PaletteColor.EMERALD).append(RabiClone.CURRENT_MAP.getView(x,y).ordinal()),Font.PROFONT_12);
Draw_Text(tileX+2,tileY+Font.PROFONT_12.getGlyphHeight()+2,new StringBuilder("Type:").append(PaletteColor.MIDNIGHT_BLUE).append(RabiClone.CURRENT_MAP.getType(x,y).ordinal()),Font.PROFONT_12);
Draw_Text_Ext(tileX+2,tileY+Tile.TILE_HEIGHT+2,new StringBuilder(RabiClone.CURRENT_MAP.getTile(x,y).toString()),Font.PROFONT_12,Alpha.ALPHA0,PaletteColor.CRIMSON);
}
}

@ -35,8 +35,9 @@ public class LevelRenderer extends Object{
}
}
}
Draw_Object(RabiClone.player);
Draw_Object(RabiClone.player2);
if (RabiClone.player!=null) {
Draw_Object(RabiClone.player);
}
}
protected void drawMapTileForEditorMode(int x, int y) {}

Loading…
Cancel
Save