Define tile system

Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
Nic0Nic0Nii 3 years ago
parent 633e59fb2d
commit 4f8552bd3c
  1. BIN
      JavaProjectTemplate.jar
  2. 2
      README.md
  3. 3
      src/sig/RabiClone.java
  4. 12
      src/sig/map/Map.java
  5. 4
      src/sig/map/Maps.java
  6. 56
      src/sig/map/Tile.java
  7. BIN
      tiles.png

Binary file not shown.

@ -25,3 +25,5 @@ The system will also use the SigScript updating system to keep files up-to-date.
jar Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar.
```
Configuration is modified at the top of the script file while the command list includes all included modules inside of `scripts`.
Mizue (みずえ) 水恵

@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.List;
import sig.engine.Panel;
import sig.map.Maps;
import sig.objects.Player;
import sig.engine.Object;
import java.awt.Toolkit;
@ -25,8 +26,6 @@ public class RabiClone{
public static Maps CURRENT_MAP = Maps.WORLD1;
public static void main(String[] args) {
RabiClone r = new RabiClone();
f = new JFrame(PROGRAM_NAME);
f.setResizable(false);
f.setUndecorated(true);

@ -1,4 +1,4 @@
package sig.engine;
package sig.map;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@ -11,7 +11,11 @@ public class Map {
//Maps contain 512x288 tiles, allowing for 16384x9216 pixels of action per map.
//294912 bytes = 294KB of memory storage per map.
//Since a screen normally fits 16x9 tiles, you get 32x32 (1024) screens of gameplay per world.
char[] tiles = new char[512*288];
final public static int MAP_WIDTH=512;
final public static int MAP_HEIGHT=288;
char[] tiles = new char[MAP_WIDTH*MAP_HEIGHT];
public static Map LoadMap(File mapFile) {
try {
@ -41,4 +45,8 @@ public class Map {
e.printStackTrace();
}
}
public void ModifyTile(int x,int y,Tile t) {
tiles[y*MAP_WIDTH+x]=(char)t.ordinal();
}
}

@ -1,9 +1,7 @@
package sig;
package sig.map;
import java.io.File;
import sig.engine.Map;
public enum Maps {
WORLD1("world1.map"),

@ -0,0 +1,56 @@
package sig.map;
public enum Tile {
WALL(0,0),
FLOOR(1,0),
PLATFORM_LEDGE(2,0),
INVISIBLE_WALL(0,0,false),
;
final public static int TILE_WIDTH=32;
final public static int TILE_HEIGHT=32;
int spriteSheetX,spriteSheetY;
boolean invisible;
int tileWidth=TILE_WIDTH,tileHeight=TILE_HEIGHT;
/*Tile(int spriteSheetX,int spriteSheetY,int tileWidth,int tileHeight) {
this.spriteSheetX=spriteSheetX;
this.spriteSheetY=spriteSheetY;
this.tileWidth=tileWidth;
this.tileHeight=tileHeight;
}*/
Tile(int spriteSheetX,int spriteSheetY,boolean invisible) {
this.spriteSheetX=spriteSheetX;
this.spriteSheetY=spriteSheetY;
this.invisible=invisible;
}
Tile(int spriteSheetX,int spriteSheetY) {
this(spriteSheetX, spriteSheetY, false);
}
public int getSpriteSheetX() {
return spriteSheetX;
}
public void setSpriteSheetX(int spriteSheetX) {
this.spriteSheetX = spriteSheetX;
}
public int getSpriteSheetY() {
return spriteSheetY;
}
public void setSpriteSheetY(int spriteSheetY) {
this.spriteSheetY = spriteSheetY;
}
public int getTileWidth() {
return tileWidth;
}
public void setTileWidth(int tileWidth) {
this.tileWidth = tileWidth;
}
public int getTileHeight() {
return tileHeight;
}
public void setTileHeight(int tileHeight) {
this.tileHeight = tileHeight;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Loading…
Cancel
Save