public Hud(Game1 game, Player player) { this.screenBox = new Rectangle(0, 0, game.mapWidth, game.mapHeight); this.player = player; this.thermoFrame = game.ConditionalLoadSprite("thermoframe", "sprites/thermo_frame-01"); this.thermoFill = game.ConditionalLoadSprite("thermofill", "sprites/thermo_fill-01"); this.warningCool = game.ConditionalLoadSprite("tiles/warning_cool-01"); this.warningHot = game.ConditionalLoadSprite("tiles/warning_heat-01"); }
public Player(int x, int y, Sprite sprite, Game1 g, ViewArea viewArea) : base(x, y, sprite) { startPosition = new Vector2(x, y); Position = new Vector2(x, y); game = g; heat = 30; velocity = Vector2.Zero; acceleration = Vector2.Zero; this.viewArea = viewArea; this.punchSprite = new Sprite(g.ConditionalLoadSprite("punch", "sprites/fireball")); this.SetupAnimationSprites(); }
public Parallax(Game1 game) { this.backLayer = game.ConditionalLoadSprite("tiles/scene-01"); this.frontLayer = game.ConditionalLoadSprite("tiles/scene2-01"); this.destRect = new Rectangle(0, 0, game.mapWidth, game.mapHeight); }
private static void handleLayer(Game1 game, JObject layer, Dictionary<int, TileInfo> tileinfo, List<Block> blocks) { game.currentMap.Height = (int)layer["height"]; int width = game.currentMap.Width = (int)layer["width"]; JArray blockData = (JArray)layer["data"]; for (int y = 0; y < game.currentMap.Height; y++) { for (int x = 0; x < width; x++) { int pos = y * width + x; int curItem = (int)blockData[pos]; if (curItem == 0) continue; TileInfo ti = tileinfo[curItem]; Sprite sprite = new Sprite(game.ConditionalLoadSprite(ti.Loc, ti.Path), ti.Origin); blocks.Add(new Block(x * Game1.TILE_SIZE, y * Game1.TILE_SIZE, sprite)); } } game.currentMap.ReduceCollisionBlocks(); }
private static Block handleInteractiveTile(Game1 game, Dictionary<int, TileInfo> tileinfo, JObject obj, string name, string kind, int x, int y) { int gid = (int)obj["gid"]; var ti = tileinfo[gid]; Sprite sprite = new Sprite(game.ConditionalLoadSprite(ti.Loc, ti.Path), ti.Origin); y = y - 32; switch (kind) { case "door": return new SwitchBlock(x, y, sprite); // FIXME case "switch": return new SwitchBlock(x, y, sprite); case "breakable": var b = new BreakableBlock(x, y, sprite, game.currentMap); return b; case "lantern": var lb = new LanternBlock(x, y, sprite, name); game.currentMap.AddSpawn(x, y, name); return lb; } return null; }