Mario Bros Java Game 240x320 | Super

Mario Bros Java Game 240x320 | Super

// --- Flag --- class Flag { int x, y; Flag(int x, int y) { this.x = x; this.y = y; } Rectangle getBounds() { return new Rectangle(x, y, 8, 16); } void draw(Graphics2D g, int screenX, int screenY) { g.setColor(Color.RED); g.fillRect(screenX, screenY, 4, 20); g.fillPolygon(new int[]{screenX + 4, screenX + 16, screenX + 4}, new int[]{screenY, screenY + 8, screenY + 16}, 3); } }

Mario(int startX, int groundY) { x = startX; y = groundY - height; } super mario bros java game 240x320

// flag at end flag = new Flag((levelWidth - 3) * TILE_SIZE, 18 * TILE_SIZE - TILE_SIZE); } // --- Flag --- class Flag { int

// flag collision if (mario.getBounds().intersects(flag.getBounds())) { gameWin = true; gameRunning = false; } int y) { this.x = x

private void buildLevel() { tiles = new Tile[levelWidth][SCREEN_HEIGHT / TILE_SIZE + 2];

private Timer timer;