diff --git a/assets/OEM437_16_ex.pdn b/assets/OEM437_16_ex.pdn index 84766b5..52431aa 100644 Binary files a/assets/OEM437_16_ex.pdn and b/assets/OEM437_16_ex.pdn differ diff --git a/assets/OEM437_16_ex.png b/assets/OEM437_16_ex.png index 73c13aa..89642fe 100644 Binary files a/assets/OEM437_16_ex.png and b/assets/OEM437_16_ex.png differ diff --git a/docs/video-preamble.md b/docs/video-preamble.md new file mode 100644 index 0000000..038e342 --- /dev/null +++ b/docs/video-preamble.md @@ -0,0 +1,9 @@ +μ-hack is a traditional roguelike written in MiniScript. + +# References + +- [Git](https://github.com/treytomes/micro-hack) +- [itch.io](https://treytomes.itch.io/micro-hack) + - The web viewer is a little buggy at the moment, but the OS-specific downloads have been working great. +- [MiniScript](https://miniscript.org/) +- [Mini Micro](https://miniscript.org/MiniMicro/) diff --git a/src/MapDisplay.ms b/src/MapDisplay.ms index b998261..97a4454 100644 --- a/src/MapDisplay.ms +++ b/src/MapDisplay.ms @@ -38,18 +38,18 @@ MapDisplay.flip = function() self.activeDisplay = 1 self.display = self.display1 - self.displayBack = self.display1Back + // self.displayBack = self.display1Back self.display0.install self.displayNumberFront - self.display0Back.install self.displayNumberBack + // self.display0Back.install self.displayNumberBack else self.activeDisplay = 0 self.display = self.display0 - self.displayBack = self.display0Back + // self.displayBack = self.display0Back self.display1.install self.displayNumberFront - self.display1Back.install self.displayNumberBack + // self.display1Back.install self.displayNumberBack end if return self end function @@ -58,22 +58,22 @@ MapDisplay.scrollTo = function(x, y) self.display0.scrollX = x self.display0.scrollY = y - self.display0Back.scrollX = x - self.display0Back.scrollY = y + // self.display0Back.scrollX = x + // self.display0Back.scrollY = y self.display1.scrollX = x self.display1.scrollY = y - self.display1Back.scrollX = x - self.display1Back.scrollY = y + // self.display1Back.scrollX = x + // self.display1Back.scrollY = y end function MapDisplay.setCellBackColor = function(x, y, backColor) - if backColor isa Color then - backColor = backColor.str() - end if - self.displayBack.setCell x, y, constants.TILE_INDEX_SOLID - self.displayBack.setCellTint x, y, backColor + // if backColor isa Color then + // backColor = backColor.str() + // end if + // self.displayBack.setCell x, y, constants.TILE_INDEX_SOLID + // self.displayBack.setCellTint x, y, backColor end function MapDisplay.setCell = function(x, y, tile, color="#FFFFFF", backColor = "#00000000") @@ -86,7 +86,7 @@ MapDisplay.setCell = function(x, y, tile, color="#FFFFFF", backColor = "#0000000 end if self.display.setCell x, y, tile self.display.setCellTint x, y, color - self.setCellBackColor x, y, backColor + // self.setCellBackColor x, y, backColor end function MapDisplay.clear = function(fg="#000000", bg="#00000000") diff --git a/src/factories/entities.ms b/src/factories/entities.ms index 0d40c53..fdfc701 100644 --- a/src/factories/entities.ms +++ b/src/factories/entities.ms @@ -1,7 +1,6 @@ // Entity Factory makePlayer = function() - // t = tile.make(char(57872), Color.white, Color.black, true, false) // TODO t = tile.make(255+16-3, Color.white, Color.black, true, false) e = (new entity.Entity).init(t, races.human, classes.fighter) @@ -55,7 +54,7 @@ makePlayer = function() end function makeSign = function(map, pnt, msg) - t = tile.make("-", Color.white, Color.brown, true, false) + t = tile.make(24 * 16 + 8, Color.white, Color.brown, true, false) e = (new entity.Entity).init(t, races.npc, classes.classless, pnt) e.name = "sign" e.description = "The sign reads: ""{0}""".fill([msg]) diff --git a/src/factories/tiles.ms b/src/factories/tiles.ms index 837b47e..7348787 100644 --- a/src/factories/tiles.ms +++ b/src/factories/tiles.ms @@ -1,31 +1,57 @@ +// Colored tiles start at index 24 * 16 + 0. + makeFloor = function() - return tile.make(".", Color.brown.dark, Color.black, false, false).setName("floor") + // return tile.make(".", Color.brown.dark, Color.black, false, false).setName("floor") + return tile.make(24 * 16 + 0, Color.white, Color.white, false, false). + setName("floor"). + setMapColor(Color.brown.dark) end function makeGrass = function() - return tile.make(".", Color.green.dark, Color.green.darker, false, false).setName("grass") -end function - -makeMountain = function() - return tile.make("#", Color.gray.darker.darker, Color.gray.dark.dark, true, true).setName("mountain") + // return tile.make(".", Color.green.dark, Color.green.darker, false, false).setName("grass") + return tile.make(24 * 16 + 1, Color.white, Color.white, false, false). + setName("grass"). + setMapColor(Color.green.dark) end function -makeStairsUp = function() - return tile.make("<", Color.brown.dark, Color.black, false, false).setName("stairs up") +makeHidden = function() + // return tile.make("#", Color.black, Color.gray, true, true).setName("hidden") + return tile.make(24 * 16 + 2, Color.white, Color.white, true, true). + setName("hidden"). + setMapColor(Color.black) end function -makeStairsDown = function() - return tile.make(">", Color.brown.dark, Color.black, false, false).setName("stairs down") +makeMountain = function() + // return tile.make("#", Color.gray.darker.darker, Color.gray.dark.dark, true, true).setName("mountain") + return tile.make(24 * 16 + 3, Color.white, Color.white, true, true). + setName("mountain"). + setMapColor(Color.gray.darker.darker) end function makeWall = function() - return tile.make("#", Color.brown, Color.black, true, true).setName("wall") + // return tile.make("#", Color.brown, Color.black, true, true).setName("wall") + return tile.make(24 * 16 + 4, Color.white, Color.white, true, true). + setName("wall"). + setMapColor(Color.brown) end function makeDoor = function() - return tile.make("+", Color.black, Color.brown, false, true).setName("door") + // return tile.make("+", Color.black, Color.brown, false, true).setName("door") + return tile.make(24 * 16 + 5, Color.white, Color.white, false, true). + setName("door"). + setMapColor(Color.black) end function -makeHidden = function() - return tile.make("#", Color.black, Color.gray, true, true).setName("hidden") +makeStairsUp = function() + // return tile.make("<", Color.brown.dark, Color.black, false, false).setName("stairs up") + return tile.make(24 * 16 + 6, Color.white, Color.white, false, false). + setName("stairs up"). + setMapColor(Color.brown.dark) end function + +makeStairsDown = function() + // return tile.make(">", Color.brown.dark, Color.black, false, false).setName("stairs down") + return tile.make(24 * 16 + 7, Color.white, Color.white, false, false). + setName("stairs down"). + setMapColor(Color.brown.dark) +end function \ No newline at end of file diff --git a/src/map.ms b/src/map.ms index faa5ae8..a39c159 100644 --- a/src/map.ms +++ b/src/map.ms @@ -121,7 +121,7 @@ end function Map.clear = function(dsp) for y in range(0, SCREEN_MAX_Y - 1) for x in range(0, SCREEN_MAX_X) - dsp.setCell x, y, "#", color.black, color.gray + dsp.setCell x, y, 24 * 16 + 2, color.white, color.white end for end for end function @@ -141,7 +141,7 @@ Map.drawTile = function(dsp, x, y, renderOffset=null) end if if not math.isInRange(x, 0, self.width - 1) or not math.isInRange(y, 0, self.height - 1) then - dsp.setCell rx, ry, "#", color.black, color.gray + dsp.setCell rx, ry, 24 * 16 + 2, color.white, color.white return end if @@ -160,7 +160,7 @@ Map.drawTile = function(dsp, x, y, renderOffset=null) // c = t.foregroundColor.str() // Display.pixels.setPixel constants.PIXEL_WIDTH - x - 1, constants.PIXEL_HEIGHT - y - 1, c else - dsp.setCell rx, ry, "#", color.black, color.gray + dsp.setCell rx, ry, 24 * 16 + 2, color.white, color.white // // Draw minimap. // c = color.gray @@ -186,7 +186,7 @@ Map.drawMiniMap = function() rx = constants.PIXEL_WIDTH - (renderWidth - x * cellSize) - borderSize - 1 ry = constants.PIXEL_HEIGHT - (renderHeight - y * cellSize) - borderSize - 1 if tile.hasBeenVisited then - c = tile.foregroundColor.str() + c = tile.mapColor.str() // Display.pixels.setPixel rx, ry, c Display.pixels.drawRect rx, ry, cellSize, cellSize, c, 1 else @@ -205,7 +205,7 @@ Map.drawMiniMap = function() continue end if - c = e.tile.foregroundColor.str() + c = e.tile.mapColor.str() rx = constants.PIXEL_WIDTH - (renderWidth - ex * cellSize) - borderSize - 1 ry = constants.PIXEL_HEIGHT - (renderHeight - ey * cellSize) - borderSize - 1 diff --git a/src/tile.ms b/src/tile.ms index 56fa85d..bacb559 100644 --- a/src/tile.ms +++ b/src/tile.ms @@ -1,9 +1,15 @@ Tile = {} +// TODO: Remove tile background color. + Tile.init = function(char, foregroundColor, backgroundColor=null, blocksMovement=false, blocksVision=false) self.char = char self.foregroundColor = foregroundColor self.backgroundColor = math.coalesce(backgroundColor, Color.black) + + // The map color is used for the minimap. + self.mapColor = self.foregroundColor + self.blocksMovement = blocksMovement self.blocksVision = blocksVision self.name = "" @@ -45,6 +51,11 @@ Tile.setName = function(name) return self end function +Tile.setMapColor = function(c) + self.mapColor = c + return self +end function + make = function(char, foregroundColor, backgroundColor, blocksMovement=false, blocksVision=false) t = (new Tile) t.init(char, foregroundColor, backgroundColor, blocksMovement, blocksVision)