public static void renderFrame(Screen screen, string title, int x0, int y0, int x1, int y1) { for (int y = y0; y <= y1; y++) { for (int x = x0; x <= x1; x++) { if (x == x0 && y == y0) screen.render(x * 8, y * 8, 0 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 0); else if (x == x1 && y == y0) screen.render(x * 8, y * 8, 0 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 1); else if (x == x0 && y == y1) screen.render(x * 8, y * 8, 0 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 2); else if (x == x1 && y == y1) screen.render(x * 8, y * 8, 0 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 3); else if (y == y0) screen.render(x * 8, y * 8, 1 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 0); else if (y == y1) screen.render(x * 8, y * 8, 1 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 2); else if (x == x0) screen.render(x * 8, y * 8, 2 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 0); else if (x == x1) screen.render(x * 8, y * 8, 2 + 13 * 32, ColorHelper.get(-1, 1, 5, 445), 1); else screen.render(x * 8, y * 8, 2 + 13 * 32, ColorHelper.get(5, 5, 5, 5), 1); } } draw(title, screen, x0 * 8 + 8, y0 * 8, ColorHelper.get(5, 5, 5, 550)); }
public override void render(Screen screen) { screen.render(x - 8, y - 8 - 4, sprite * 2 + 8 * 32, col, 0); screen.render(x - 0, y - 8 - 4, sprite * 2 + 8 * 32 + 1, col, 0); screen.render(x - 8, y - 0 - 4, sprite * 2 + 8 * 32 + 32, col, 0); screen.render(x - 0, y - 0 - 4, sprite * 2 + 8 * 32 + 33, col, 0); }
public void renderItemList(Screen screen, int xo, int yo, int x1, int y1, IEnumerable<ListItem> listItemsIter, int selected) { var listItems = listItemsIter.ToArray(); bool renderCursor = true; if (selected < 0) { selected = -selected - 1; renderCursor = false; } int w = x1 - xo; int h = y1 - yo - 1; int i0 = 0; int i1 = listItems.Length; if (i1 > h) i1 = h; int io = selected - h / 2; if (io > listItems.Length - h) io = listItems.Length - h; if (io < 0) io = 0; for (int i = i0; i < i1; i++) { listItems[i + io].renderInventory(screen, (1 + xo) * 8, (i + 1 + yo) * 8); } if (renderCursor) { int yy = selected + 1 - io + yo; Font.draw(">", screen, (xo + 0) * 8, yy * 8, ColorHelper.get(5, 555, 555, 555)); Font.draw("<", screen, (xo + w) * 8, yy * 8, ColorHelper.get(5, 555, 555, 555)); } }
public override void render(Screen screen) { Font.renderFrame(screen, "", 1, 3, 18, 9); Font.draw("You died! Aww!", screen, 2 * 8, 4 * 8, ColorHelper.get(-1, 555, 555, 555)); int seconds = game.gameTime / 60; int minutes = seconds / 60; int hours = minutes / 60; minutes %= 60; seconds %= 60; string timeString = ""; if (hours > 0) { timeString = hours + "h" + (minutes < 10 ? "0" : "") + minutes + "m"; } else { timeString = minutes + "m " + (seconds < 10 ? "0" : "") + seconds + "s"; } Font.draw("Time:", screen, 2 * 8, 5 * 8, ColorHelper.get(-1, 555, 555, 555)); Font.draw(timeString, screen, (2 + 5) * 8, 5 * 8, ColorHelper.get(-1, 550, 550, 550)); Font.draw("Score:", screen, 2 * 8, 6 * 8, ColorHelper.get(-1, 555, 555, 555)); Font.draw("" + game.player.score, screen, (2 + 6) * 8, 6 * 8, ColorHelper.get(-1, 550, 550, 550)); Font.draw("Press C to lose", screen, 2 * 8, 8 * 8, ColorHelper.get(-1, 333, 333, 333)); }
public override void render(Screen screen) { screen.clear(0); int h = 2; int w = 13; int titleColor = ColorHelper.get(0, 010, 131, 551); int xo = (screen.w - w * 8) / 2; int yo = 24; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { screen.render(xo + x * 8, yo + y * 8, x + (y + 6) * 32, titleColor, 0); } } for (int i = 0; i < 3; i++) { string msg = options[i]; int col = ColorHelper.get(0, 222, 222, 222); if (i == selected) { msg = "> " + msg + " <"; col = ColorHelper.get(0, 555, 555, 555); } Font.draw(msg, screen, (screen.w - msg.Length * 8) / 2, (8 + i) * 8, col); } Font.draw("(Arrow keys,X and C)", screen, 0, screen.h - 8, ColorHelper.get(0, 111, 111, 111)); }
public override void render(Screen screen) { int xt = 0; int yt = 18; int xo = x - 8; int yo = y - 11; if (jumpTime > 0) { xt += 2; yo -= 4; } int col = ColorHelper.get(-1, 10, 252, 555); if (lvl == 2) col = ColorHelper.get(-1, 100, 522, 555); if (lvl == 3) col = ColorHelper.get(-1, 111, 444, 555); if (lvl == 4) col = ColorHelper.get(-1, 000, 111, 224); if (hurtTime > 0) { col = ColorHelper.get(-1, 555, 555, 555); } screen.render(xo + 0, yo + 0, xt + yt * 32, col, 0); screen.render(xo + 8, yo + 0, xt + 1 + yt * 32, col, 0); screen.render(xo + 0, yo + 8, xt + (yt + 1) * 32, col, 0); screen.render(xo + 8, yo + 8, xt + 1 + (yt + 1) * 32, col, 0); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(20, 40, 50, level.sandColor); screen.render(x * 16 + 0, y * 16 + 0, 8 + 2 * 32, col, 0); screen.render(x * 16 + 8, y * 16 + 0, 9 + 2 * 32, col, 0); screen.render(x * 16 + 0, y * 16 + 8, 8 + 3 * 32, col, 0); screen.render(x * 16 + 8, y * 16 + 8, 9 + 3 * 32, col, 0); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(level.dirtColor, level.dirtColor, level.dirtColor - 111, level.dirtColor - 111); screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0); screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0); screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0); }
public override void renderInventory(Screen screen, int x, int y) { screen.render(x, y, resource.sprite, resource.color, 0); Font.draw(resource.name, screen, x + 32, y, ColorHelper.get(-1, 555, 555, 555)); int cc = count; if (cc > 999) cc = 999; Font.draw("" + cc, screen, x + 8, y, ColorHelper.get(-1, 444, 444, 444)); }
public override void render(Screen screen) { int col = ColorHelper.get(-1, 555, 555, 555); screen.render(x - 8, y - 8, 5 + 12 * 32, col, 2); screen.render(x - 0, y - 8, 5 + 12 * 32, col, 3); screen.render(x - 8, y - 0, 5 + 12 * 32, col, 0); screen.render(x - 0, y - 0, 5 + 12 * 32, col, 1); }
public override void render(Screen screen, Level level, int x, int y) { //TODO: check is casting to int is ok color = (int)(toDrop.color & 0xffffff00) + ColorHelper.get(level.dirtColor); screen.render(x * 16 + 0, y * 16 + 0, 17 + 1 * 32, color, 0); screen.render(x * 16 + 8, y * 16 + 0, 18 + 1 * 32, color, 0); screen.render(x * 16 + 0, y * 16 + 8, 17 + 2 * 32, color, 0); screen.render(x * 16 + 8, y * 16 + 8, 18 + 2 * 32, color, 0); }
public override void render(Screen screen) { if (time >= lifeTime - 6 * 20) { if (time / 6 % 2 == 0) return; } screen.render(x - 4, y - 4, item.getSprite(), ColorHelper.get(-1, 0, 0, 0), 0); screen.render(x - 4, y - 4 - (int)(zz), item.getSprite(), item.getColor(), 0); }
public override void render(Screen screen, Level level, int x, int y) { int color = ColorHelper.get(level.dirtColor, 000, 333, 444); int xt = 0; if (leadsUp) xt = 2; screen.render(x * 16 + 0, y * 16 + 0, xt + 2 * 32, color, 0); screen.render(x * 16 + 8, y * 16 + 0, xt + 1 + 2 * 32, color, 0); screen.render(x * 16 + 0, y * 16 + 8, xt + 3 * 32, color, 0); screen.render(x * 16 + 8, y * 16 + 8, xt + 1 + 3 * 32, color, 0); }
public override void render(Screen screen) { if (window == 1) screen.setOffset(6 * 8, 0); Font.renderFrame(screen, title, 1, 1, 12, 11); renderItemList(screen, 1, 1, 12, 11, container.items, window == 0 ? selected : -oSelected - 1); Font.renderFrame(screen, "inventory", 13, 1, 13 + 11, 11); renderItemList(screen, 13, 1, 13 + 11, 11, player.inventory.items, window == 1 ? selected : -oSelected - 1); screen.setOffset(0, 0); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(334, 334, 223, 223); int transitionColor = ColorHelper.get(001, 334, 445, level.dirtColor); bool u = level.getTile(x, y - 1) != this; bool d = level.getTile(x, y + 1) != this; bool l = level.getTile(x - 1, y) != this; bool r = level.getTile(x + 1, y) != this; bool ul = level.getTile(x - 1, y - 1) != this; bool dl = level.getTile(x - 1, y + 1) != this; bool ur = level.getTile(x + 1, y - 1) != this; bool dr = level.getTile(x + 1, y + 1) != this; if (!u && !l) { if (!ul) screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); else screen.render(x * 16 + 0, y * 16 + 0, 7 + 0 * 32, transitionColor, 3); } else screen.render(x * 16 + 0, y * 16 + 0, (l ? 6 : 5) + (u ? 2 : 1) * 32, transitionColor, 3); if (!u && !r) { if (!ur) screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0); else screen.render(x * 16 + 8, y * 16 + 0, 8 + 0 * 32, transitionColor, 3); } else screen.render(x * 16 + 8, y * 16 + 0, (r ? 4 : 5) + (u ? 2 : 1) * 32, transitionColor, 3); if (!d && !l) { if (!dl) screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0); else screen.render(x * 16 + 0, y * 16 + 8, 7 + 1 * 32, transitionColor, 3); } else screen.render(x * 16 + 0, y * 16 + 8, (l ? 6 : 5) + (d ? 0 : 1) * 32, transitionColor, 3); if (!d && !r) { if (!dr) screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0); else screen.render(x * 16 + 8, y * 16 + 8, 8 + 1 * 32, transitionColor, 3); } else screen.render(x * 16 + 8, y * 16 + 8, (r ? 4 : 5) + (d ? 0 : 1) * 32, transitionColor, 3); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(444, 444, 555, 555); int transitionColor = ColorHelper.get(333, 444, 555, -1); bool u = level.getTile(x, y - 1) == Tile.infiniteFall; bool d = level.getTile(x, y + 1) == Tile.infiniteFall; bool l = level.getTile(x - 1, y) == Tile.infiniteFall; bool r = level.getTile(x + 1, y) == Tile.infiniteFall; bool ul = level.getTile(x - 1, y - 1) == Tile.infiniteFall; bool dl = level.getTile(x - 1, y + 1) == Tile.infiniteFall; bool ur = level.getTile(x + 1, y - 1) == Tile.infiniteFall; bool dr = level.getTile(x + 1, y + 1) == Tile.infiniteFall; if (!u && !l) { if (!ul) screen.render(x * 16 + 0, y * 16 + 0, 17, col, 0); else screen.render(x * 16 + 0, y * 16 + 0, 7 + 0 * 32, transitionColor, 3); } else screen.render(x * 16 + 0, y * 16 + 0, (l ? 6 : 5) + (u ? 2 : 1) * 32, transitionColor, 3); if (!u && !r) { if (!ur) screen.render(x * 16 + 8, y * 16 + 0, 18, col, 0); else screen.render(x * 16 + 8, y * 16 + 0, 8 + 0 * 32, transitionColor, 3); } else screen.render(x * 16 + 8, y * 16 + 0, (r ? 4 : 5) + (u ? 2 : 1) * 32, transitionColor, 3); if (!d && !l) { if (!dl) screen.render(x * 16 + 0, y * 16 + 8, 20, col, 0); else screen.render(x * 16 + 0, y * 16 + 8, 7 + 1 * 32, transitionColor, 3); } else screen.render(x * 16 + 0, y * 16 + 8, (l ? 6 : 5) + (d ? 0 : 1) * 32, transitionColor, 3); if (!d && !r) { if (!dr) screen.render(x * 16 + 8, y * 16 + 8, 19, col, 0); else screen.render(x * 16 + 8, y * 16 + 8, 8 + 1 * 32, transitionColor, 3); } else screen.render(x * 16 + 8, y * 16 + 8, (r ? 4 : 5) + (d ? 0 : 1) * 32, transitionColor, 3); }
public static void draw(string msg, Screen screen, int x, int y, int col) { msg = msg.ToUpper(); for (int i = 0; i < msg.Length; i++) { int ix = chars.IndexOf(msg[i]); if (ix >= 0) { screen.render(x + i * 8, y, ix + 30 * 32, col, 0); } } }
public override void render(Screen screen) { if (time >= lifeTime - 6 * 20) { if (time / 6 % 2 == 0) return; } int xt = 8; int yt = 13; screen.render(x - 4, y - 4 - 2, xt + yt * 32, ColorHelper.get(-1, 555, 555, 555), random.nextInt(4)); screen.render(x - 4, y - 4 + 2, xt + yt * 32, ColorHelper.get(-1, 000, 000, 000), random.nextInt(4)); }
public override void render(Screen screen) { screen.clear(0); Font.draw("About Minicraft", screen, 2 * 8 + 4, 1 * 8, ColorHelper.get(0, 555, 555, 555)); Font.draw("Minicraft was made", screen, 0 * 8 + 4, 3 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("by Markus Persson", screen, 0 * 8 + 4, 4 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("For the 22'nd ludum", screen, 0 * 8 + 4, 5 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("dare competition in", screen, 0 * 8 + 4, 6 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("december 2011.", screen, 0 * 8 + 4, 7 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("it is dedicated to", screen, 0 * 8 + 4, 9 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("my father. <3", screen, 0 * 8 + 4, 10 * 8, ColorHelper.get(0, 333, 333, 333)); }
public override void render(Screen screen, Level level, int x, int y) { base.render(screen, level, x, y); int data = level.getData(x, y); int shape = (data / 16) % 2; int flowerCol = ColorHelper.get(10, level.grassColor, 555, 440); if (shape == 0) screen.render(x * 16 + 0, y * 16 + 0, 1 + 1 * 32, flowerCol, 0); if (shape == 1) screen.render(x * 16 + 8, y * 16 + 0, 1 + 1 * 32, flowerCol, 0); if (shape == 1) screen.render(x * 16 + 0, y * 16 + 8, 1 + 1 * 32, flowerCol, 0); if (shape == 0) screen.render(x * 16 + 8, y * 16 + 8, 1 + 1 * 32, flowerCol, 0); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(10, 30, 151, level.grassColor); int barkCol1 = ColorHelper.get(10, 30, 430, level.grassColor); int barkCol2 = ColorHelper.get(10, 30, 320, level.grassColor); bool u = level.getTile(x, y - 1) == this; bool l = level.getTile(x - 1, y) == this; bool r = level.getTile(x + 1, y) == this; bool d = level.getTile(x, y + 1) == this; bool ul = level.getTile(x - 1, y - 1) == this; bool ur = level.getTile(x + 1, y - 1) == this; bool dl = level.getTile(x - 1, y + 1) == this; bool dr = level.getTile(x + 1, y + 1) == this; if (u && ul && l) { screen.render(x * 16 + 0, y * 16 + 0, 10 + 1 * 32, col, 0); } else { screen.render(x * 16 + 0, y * 16 + 0, 9 + 0 * 32, col, 0); } if (u && ur && r) { screen.render(x * 16 + 8, y * 16 + 0, 10 + 2 * 32, barkCol2, 0); } else { screen.render(x * 16 + 8, y * 16 + 0, 10 + 0 * 32, col, 0); } if (d && dl && l) { screen.render(x * 16 + 0, y * 16 + 8, 10 + 2 * 32, barkCol2, 0); } else { screen.render(x * 16 + 0, y * 16 + 8, 9 + 1 * 32, barkCol1, 0); } if (d && dr && r) { screen.render(x * 16 + 8, y * 16 + 8, 10 + 1 * 32, col, 0); } else { screen.render(x * 16 + 8, y * 16 + 8, 10 + 3 * 32, barkCol2, 0); } }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(level.sandColor + 2, level.sandColor, level.sandColor - 110, level.sandColor - 110); int transitionColor = ColorHelper.get(level.sandColor - 110, level.sandColor, level.sandColor - 110, level.dirtColor); bool u = !level.getTile(x, y - 1).connectsToSand; bool d = !level.getTile(x, y + 1).connectsToSand; bool l = !level.getTile(x - 1, y).connectsToSand; bool r = !level.getTile(x + 1, y).connectsToSand; bool steppedOn = level.getData(x, y) > 0; if (!u && !l) { if (!steppedOn) screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); else screen.render(x * 16 + 0, y * 16 + 0, 3 + 1 * 32, col, 0); } else screen.render(x * 16 + 0, y * 16 + 0, (l ? 11 : 12) + (u ? 0 : 1) * 32, transitionColor, 0); if (!u && !r) { screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0); } else screen.render(x * 16 + 8, y * 16 + 0, (r ? 13 : 12) + (u ? 0 : 1) * 32, transitionColor, 0); if (!d && !l) { screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0); } else screen.render(x * 16 + 0, y * 16 + 8, (l ? 11 : 12) + (d ? 2 : 1) * 32, transitionColor, 0); if (!d && !r) { if (!steppedOn) screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0); else screen.render(x * 16 + 8, y * 16 + 8, 3 + 1 * 32, col, 0); } else screen.render(x * 16 + 8, y * 16 + 8, (r ? 13 : 12) + (d ? 2 : 1) * 32, transitionColor, 0); }
public override void render(Screen screen) { for (int x = 0; x < 20; x++) { for (int y = 0; y < 15; y++) { int dd = (y + x % 2 * 2 + x / 3) - time; if (dd < 0 && dd > -30) { if (dir > 0) screen.render(x * 8, y * 8, 0, 0, 0); else screen.render(x * 8, screen.h - y * 8 - 8, 0, 0, 0); } } } }
public override void render(Screen screen) { screen.clear(0); Font.draw("HOW TO PLAY", screen, 4 * 8 + 4, 1 * 8, ColorHelper.get(0, 555, 555, 555)); Font.draw("Move your character", screen, 0 * 8 + 4, 3 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("with the arrow keys", screen, 0 * 8 + 4, 4 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("press C to attack", screen, 0 * 8 + 4, 5 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("and X to open the", screen, 0 * 8 + 4, 6 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("inventory and to", screen, 0 * 8 + 4, 7 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("use items.", screen, 0 * 8 + 4, 8 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("Select an item in", screen, 0 * 8 + 4, 9 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("the inventory to", screen, 0 * 8 + 4, 10 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("equip it.", screen, 0 * 8 + 4, 11 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("Kill the air wizard", screen, 0 * 8 + 4, 12 * 8, ColorHelper.get(0, 333, 333, 333)); Font.draw("to win the game!", screen, 0 * 8 + 4, 13 * 8, ColorHelper.get(0, 333, 333, 333)); }
public override void render(Screen screen, Level level, int x, int y) { wRandom = new Random((int)((tickCount + (x / 2 - y) * 4311) / 10 * 54687121L + x * 3271612L + y * 3412987161L)); //TODO: wRandom.setSeed((tickCount + (x / 2 - y) * 4311) / 10 * 54687121L + x * 3271612L + y * 3412987161L); int col = ColorHelper.get(500, 500, 520, 550); int transitionColor1 = ColorHelper.get(3, 500, level.dirtColor - 111, level.dirtColor); int transitionColor2 = ColorHelper.get(3, 500, level.sandColor - 110, level.sandColor); bool u = !level.getTile(x, y - 1).connectsToLava; bool d = !level.getTile(x, y + 1).connectsToLava; bool l = !level.getTile(x - 1, y).connectsToLava; bool r = !level.getTile(x + 1, y).connectsToLava; bool su = u && level.getTile(x, y - 1).connectsToSand; bool sd = d && level.getTile(x, y + 1).connectsToSand; bool sl = l && level.getTile(x - 1, y).connectsToSand; bool sr = r && level.getTile(x + 1, y).connectsToSand; if (!u && !l) { screen.render(x * 16 + 0, y * 16 + 0, wRandom.nextInt(4), col, wRandom.nextInt(4)); } else screen.render(x * 16 + 0, y * 16 + 0, (l ? 14 : 15) + (u ? 0 : 1) * 32, (su || sl) ? transitionColor2 : transitionColor1, 0); if (!u && !r) { screen.render(x * 16 + 8, y * 16 + 0, wRandom.nextInt(4), col, wRandom.nextInt(4)); } else screen.render(x * 16 + 8, y * 16 + 0, (r ? 16 : 15) + (u ? 0 : 1) * 32, (su || sr) ? transitionColor2 : transitionColor1, 0); if (!d && !l) { screen.render(x * 16 + 0, y * 16 + 8, wRandom.nextInt(4), col, wRandom.nextInt(4)); } else screen.render(x * 16 + 0, y * 16 + 8, (l ? 14 : 15) + (d ? 2 : 1) * 32, (sd || sl) ? transitionColor2 : transitionColor1, 0); if (!d && !r) { screen.render(x * 16 + 8, y * 16 + 8, wRandom.nextInt(4), col, wRandom.nextInt(4)); } else screen.render(x * 16 + 8, y * 16 + 8, (r ? 16 : 15) + (d ? 2 : 1) * 32, (sd || sr) ? transitionColor2 : transitionColor1, 0); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(111, 111, 110, 110); int transitionColor1 = ColorHelper.get(3, 111, level.dirtColor - 111, level.dirtColor); int transitionColor2 = ColorHelper.get(3, 111, level.sandColor - 110, level.sandColor); bool u = !level.getTile(x, y - 1).connectsToLiquid(); bool d = !level.getTile(x, y + 1).connectsToLiquid(); bool l = !level.getTile(x - 1, y).connectsToLiquid(); bool r = !level.getTile(x + 1, y).connectsToLiquid(); bool su = u && level.getTile(x, y - 1).connectsToSand; bool sd = d && level.getTile(x, y + 1).connectsToSand; bool sl = l && level.getTile(x - 1, y).connectsToSand; bool sr = r && level.getTile(x + 1, y).connectsToSand; if (!u && !l) { screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); } else screen.render(x * 16 + 0, y * 16 + 0, (l ? 14 : 15) + (u ? 0 : 1) * 32, (su || sl) ? transitionColor2 : transitionColor1, 0); if (!u && !r) { screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0); } else screen.render(x * 16 + 8, y * 16 + 0, (r ? 16 : 15) + (u ? 0 : 1) * 32, (su || sr) ? transitionColor2 : transitionColor1, 0); if (!d && !l) { screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0); } else screen.render(x * 16 + 0, y * 16 + 8, (l ? 14 : 15) + (d ? 2 : 1) * 32, (sd || sl) ? transitionColor2 : transitionColor1, 0); if (!d && !r) { screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0); } else screen.render(x * 16 + 8, y * 16 + 8, (r ? 16 : 15) + (d ? 2 : 1) * 32, (sd || sr) ? transitionColor2 : transitionColor1, 0); }
public override void render(Screen screen, Level level, int x, int y) { int age = level.getData(x, y); int col = ColorHelper.get(level.dirtColor - 121, level.dirtColor - 11, level.dirtColor, 50); int icon = age / 10; if (icon >= 3) { col = ColorHelper.get(level.dirtColor - 121, level.dirtColor - 11, 50 + (icon) * 100, 40 + (icon - 3) * 2 * 100); if (age == 50) { col = ColorHelper.get(0, 0, 50 + (icon) * 100, 40 + (icon - 3) * 2 * 100); } icon = 3; } screen.render(x * 16 + 0, y * 16 + 0, 4 + 3 * 32 + icon, col, 0); screen.render(x * 16 + 8, y * 16 + 0, 4 + 3 * 32 + icon, col, 0); screen.render(x * 16 + 0, y * 16 + 8, 4 + 3 * 32 + icon, col, 1); screen.render(x * 16 + 8, y * 16 + 8, 4 + 3 * 32 + icon, col, 1); }
public override void render(Screen screen) { int xt = 0; int yt = 14; int flip1 = (walkDist >> 3) & 1; int flip2 = (walkDist >> 3) & 1; if (dir == 1) { xt += 2; } if (dir > 1) { flip1 = 0; flip2 = ((walkDist >> 4) & 1); if (dir == 2) { flip1 = 1; } xt += 4 + ((walkDist >> 3) & 1) * 2; } int xo = x - 8; int yo = y - 11; int col = ColorHelper.get(-1, 10, 252, 050); if (lvl == 2) col = ColorHelper.get(-1, 100, 522, 050); if (lvl == 3) col = ColorHelper.get(-1, 111, 444, 050); if (lvl == 4) col = ColorHelper.get(-1, 000, 111, 020); if (hurtTime > 0) { col = ColorHelper.get(-1, 555, 555, 555); } screen.render(xo + 8 * flip1, yo + 0, xt + yt * 32, col, flip1); screen.render(xo + 8 - 8 * flip1, yo + 0, xt + 1 + yt * 32, col, flip1); screen.render(xo + 8 * flip2, yo + 8, xt + (yt + 1) * 32, col, flip2); screen.render(xo + 8 - 8 * flip2, yo + 8, xt + 1 + (yt + 1) * 32, col, flip2); }
public override void render(Screen screen) { Font.renderFrame(screen, "Have", 12, 1, 19, 3); Font.renderFrame(screen, "Cost", 12, 4, 19, 11); Font.renderFrame(screen, "Crafting", 0, 1, 11, 11); renderItemList(screen, 0, 1, 11, 11, recipes, selected); if (recipes.size() > 0) { Recipe recipe = recipes.get(selected); int hasResultItems = player.inventory.count(recipe.resultTemplate); int xo = 13 * 8; screen.render(xo, 2 * 8, recipe.resultTemplate.getSprite(), recipe.resultTemplate.getColor(), 0); Font.draw("" + hasResultItems, screen, xo + 8, 2 * 8, ColorHelper.get(-1, 555, 555, 555)); List<Item> costs = recipe.costs; for (int i = 0; i < costs.size(); i++) { Item item = costs.get(i); int yo = (5 + i) * 8; screen.render(xo, yo, item.getSprite(), item.getColor(), 0); int requiredAmt = 1; if (item is ResourceItem) { requiredAmt = ((ResourceItem)item).count; } int has = player.inventory.count(item); int color = ColorHelper.get(-1, 555, 555, 555); if (has < requiredAmt) { color = ColorHelper.get(-1, 222, 222, 222); } if (has > 99) has = 99; Font.draw("" + requiredAmt + "/" + has, screen, xo + 8, yo, color); } } // renderItemList(screen, 12, 4, 19, 11, recipes.get(selected).costs, -1); }
public override void render(Screen screen, Level level, int x, int y) { int col = ColorHelper.get(level.grassColor, level.grassColor, level.grassColor + 111, level.grassColor + 111); int transitionColor = ColorHelper.get(level.grassColor - 111, level.grassColor, level.grassColor + 111, level.dirtColor); bool u = !level.getTile(x, y - 1).connectsToGrass; bool d = !level.getTile(x, y + 1).connectsToGrass; bool l = !level.getTile(x - 1, y).connectsToGrass; bool r = !level.getTile(x + 1, y).connectsToGrass; if (!u && !l) { screen.render(x * 16 + 0, y * 16 + 0, 0, col, 0); } else screen.render(x * 16 + 0, y * 16 + 0, (l ? 11 : 12) + (u ? 0 : 1) * 32, transitionColor, 0); if (!u && !r) { screen.render(x * 16 + 8, y * 16 + 0, 1, col, 0); } else screen.render(x * 16 + 8, y * 16 + 0, (r ? 13 : 12) + (u ? 0 : 1) * 32, transitionColor, 0); if (!d && !l) { screen.render(x * 16 + 0, y * 16 + 8, 2, col, 0); } else screen.render(x * 16 + 0, y * 16 + 8, (l ? 11 : 12) + (d ? 2 : 1) * 32, transitionColor, 0); if (!d && !r) { screen.render(x * 16 + 8, y * 16 + 8, 3, col, 0); } else screen.render(x * 16 + 8, y * 16 + 8, (r ? 13 : 12) + (d ? 2 : 1) * 32, transitionColor, 0); }