public void displayMap(Level theLevel) { Vector2 currentRoom = theLevel.GetCurrentRoom; Vector2 currentRoomOrigin = theLevel.GetcurrentOrigin; // new Vector2(LowerLeft.X + 2.5f, LowerLeft.Y + 2.5f) //RoomMap[(int)currentRoom.Y, (int)currentRoom.X].Color = Color.Yellow; youAreHere = new XNACS1Rectangle(new Vector2((currentRoom.X * 5f + LowerLeft.X + 7.5f), (currentRoom.Y * 5 + LowerLeft.Y + 7.5f)), 2f, 2f); youAreHere.Texture = "princess_stick"; //RoomMap[4,3].Color = Color.Yellow; for (int j = 0; j < 6; j++) { for (int i = 0; i < 6; i++) { if (theLevel.getCurrentRoomState(j, i)) { RoomMap[i, j].Texture = "pencil_square"; } } } }
public void ShowMessage() { oMessage = new XNACS1Rectangle(new Vector2(), fMessageWidth, fMessageHeight); oMessage.Color = new Color(0, 0, 0, 150); oMessage.Label = "Move the robber"; oMessage.LabelColor = Color.White; }
protected void setupGame() { win = false; World.SetWorldCoordinate(new Vector2(0f, 0f), 100f); totalLevels = 4; path = @"level0.txt"; //this works if world1.txt is in the bin/x86/debug folder try { s = new StreamReader(path); theLevel = new Level(ref s); } catch (Exception e) { // Let the user know what went wrong. Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } currentLevel = 0; World.SetWorldCoordinate(new Vector2(0, 0), 100f); paused = gameStarted = gameOver = false; startUpScreen = new XNACS1Rectangle(new Vector2(50f, (9f / 16f) * 50f), 100f, (9f / 16f) * 100f, "newcastlebg"); selected = new XNACS1Rectangle(new Vector2(50, 30), 42, 10); selected.Color = Color.Black; easy = new XNACS1Rectangle(new Vector2(50, 45), 40, 8, "newEasy"); medium = new XNACS1Rectangle(new Vector2(50, 30), 40, 8, "newMedium"); hard = new XNACS1Rectangle(new Vector2(50, 15), 40, 8, "newHard"); tick = 120; loading = false; exiting = false; }
public void Update() { if (Collided(mTargetBlock)) { VectorComponents currentV = new VectorComponents(); currentV.Update(Center, Center + Velocity, mTargetBlock.FrontDirection); Vector2 newVelocity = currentV.TangentVector() - currentV.NormalVector(); XNACS1Rectangle reflectV = new XNACS1Rectangle(); reflectV.SetEndPoints(Center, Center + (newVelocity * kDrawSize), 0.3f); reflectV.Color = Color.DeepPink; mShowVecs.Add(currentV); mReflection.Add(reflectV); Velocity = newVelocity; } else { XNACS1Lib.BoundCollideStatus status = XNACS1Base.World.ClampAtWorldBound(this); switch (status) { case BoundCollideStatus.CollideBottom: case BoundCollideStatus.CollideTop: VelocityY = -VelocityY; break; case BoundCollideStatus.CollideLeft: case BoundCollideStatus.CollideRight: VelocityX = -VelocityX; break; } } }
public OverHeatWeapon(Hero hero) : base(hero) { overheated = false; currentHeatLevel = 0; tempTracker = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 4, GameWorld.topEdge - 4), 4, 4); }
public Debris(Hero hero, List <Enemy> enemies, float minX, float maxX) { float padding = size; float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding); float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding); texture = new XNACS1Rectangle(new Vector2(randomX, randomY), size, size); switch (XNACS1Base.RandomInt(3)) { case 0: texture.Texture = "Beak"; break; case 1: texture.Texture = "Window"; break; case 2: texture.Texture = "Wing2"; texture.Width = texture.Height * 1.8f; break; } obstacle = new Obstacle(hero, enemies, texture.Center, texture.Width * .9f, texture.Height * .9f); }
public Obstacle(Hero hero, List <Enemy> enemies, Vector2 center, float width, float height) { this.hero = hero; this.enemies = enemies; this.box = new XNACS1Rectangle(center, width, height); this.box.Color = Color.SlateGray; }
protected override void InitializeWorld() { //XNACS1Base.SetAppWindowPixelDimension(false, 1250, 300); World.SetWorldCoordinate(new Vector2(0f, 0f), 100f); totalLevels = 1; path = @"level0.txt"; //this works if world1.txt is in the bin/x86/debug folder try { s = new StreamReader(path); theLevel = new Level(ref s); } catch (Exception e) { // Let the user know what went wrong. Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } currentLevel = 0; //levelSet[currentLevel].loadInitialRoom(); -- Moved this down to where the game starts after menu World.SetWorldCoordinate(new Vector2(0, 0), 100f); paused = gameStarted = gameOver = false; selected = new XNACS1Rectangle(new Vector2(50, 30), 42, 10); selected.Color = Color.Red; easy = new XNACS1Rectangle(new Vector2(50, 45), 40, 8, "easy"); medium = new XNACS1Rectangle(new Vector2(50, 30), 40, 8, "medium"); hard = new XNACS1Rectangle(new Vector2(50, 15), 40, 8, "hard"); }
public HealthBar(Vector2 Center) { red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f); red.Color = Color.Red; green = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f); green.Color = Color.Green; }
public StartMenu() { XNACS1Base.World.SetBackgroundTexture("TitleScreen"); for (int x = 0; x < 3; x++) { Vector2 oDisp; if (oButtons.Count > 0) { oDisp = oButtons.Last().Center + oButtonDisplacement; } else { oDisp = oButtonStartingLoc; } oButtons.Add(new XNACS1Rectangle(oDisp, fButtonWidth, fButtonHeight)); oButtons.Last().Color = new Color(0, 0, 0, 0); oButtons.Last().LabelColor = Color.White; } oButtons[0].Label = "Start Game"; oButtons[1].Label = "Settings"; oButtons[2].Label = "Exit Game"; oSelectButton = new XNACS1Rectangle(oButtons[0].Center, fButtonWidth, fButtonHeight); oSelectButton.Color = new Color(100, 100, 100, 100); }
private void endStartScreen() { startButton.RemoveFromAutoDrawSet(); startButton = null; gameBase.IsMouseVisible = false; state = StartScreenState.READY_FOR_GAME; }
public EndScreen(SpaceSmasherBase game, EndState gameState) { gameBase = game; state = gameState; gameBase.IsMouseVisible = true; float worldWidth = XNACS1Lib.XNACS1Base.World.WorldDimension.X; float worldHeight = XNACS1Lib.XNACS1Base.World.WorldDimension.Y; afterGameBackground = new XNACS1Rectangle( new Vector2(worldWidth / 2, worldHeight / 2), worldWidth, worldHeight, GAMEOVER_BLUR_IMAGE); if (state == EndState.GAMEOVER) { afterGameForeground1 = new XNACS1Rectangle( new Vector2(worldWidth / 2, worldHeight / 2), 40f, 35f, GAMEOVER_STATIC_IMAGE); } else { afterGameForeground1 = new XNACS1Rectangle( new Vector2(worldWidth / 2, worldHeight / 2), 40f, 35f, GAMEWIN_STATIC_IMAGE); } }
public MonopolyMenu() { this.Width = fWidth; this.Height = fHeight; this.Center = new Vector2(50f, 30f); this.Texture = "MonopolyMenu"; for (int x = 0; x < oCards.Count(); x++) { oCards[x] = new List <XNACS1Rectangle>(); oCardDisplacements[x] = new List <Vector2>(); } for (int x = 0; x < oButtons1.Count(); x++) // bottom buttons { oButtonDisplacements1[x] = new Vector2(-7.41f + 15f * x, -9.011f); oButtons1[x] = new XNACS1Rectangle(new Vector2(), Global.PixelSize(111), Global.PixelSize(34)); oButtons1[x].UseSpriteSheet = true; oButtons1[x].SetTextureSpriteSheet("TradeMenuButtons1", 3, 1, 0); oButtons1[x].SetTextureSpriteAnimationFrames(x, 0, x, 0, 1, SpriteSheetAnimationMode.AnimateForward); oButtons1[x].LabelColor = Color.White; } oButtons1[0].Label = "Accept"; oButtons1[1].Label = "Cancel"; oButtons1[0].TextureTintColor = oUnavailableColor; for (int x = 0; x < oButtons2.Count(); x++) // resource buttons { oButtonDisplacements2[x] = new Vector2(-18f + Global.PixelSize(37) * x, 4.91f); oButtons2[x] = new XNACS1Rectangle(new Vector2(), Global.PixelSize(33), Global.PixelSize(33)); oButtons2[x].UseSpriteSheet = true; oButtons2[x].SetTextureSpriteSheet("TradeMenuButtons2", 5, 1, 0); oButtons2[x].SetTextureSpriteAnimationFrames(x, 0, x, 0, 1, SpriteSheetAnimationMode.AnimateForward); } }
public void InitializeWalls() { Vector2 RoomCenter = new Vector2(roomMin.X + 100f / 2f, roomMin.Y + ((9f / 16f) * 100f - 4.5f) / 2f); // left wall RoomWalls[0] = new XNACS1Rectangle(new Vector2(roomMin.X + 1.25f, RoomCenter.Y), 2.5f, roomMax.Y - roomMin.Y - 4.5f); allWalls.AddToSet(RoomWalls[0]); RoomWalls[0].Texture = "leftWall"; // top wall RoomWalls[1] = new XNACS1Rectangle(new Vector2(RoomCenter.X, roomMax.Y - 4.25f - 1.25f), roomMax.X - roomMin.X, 2.5f); allWalls.AddToSet(RoomWalls[1]); RoomWalls[1].Texture = "topWall"; // right wall RoomWalls[2] = new XNACS1Rectangle(new Vector2(roomMax.X - 1.25f, RoomCenter.Y), 2.5f, roomMax.Y - roomMin.Y - 4.5f); allWalls.AddToSet(RoomWalls[2]); RoomWalls[2].Texture = "leftWall"; // bottom wall RoomWalls[3] = new XNACS1Rectangle(new Vector2(RoomCenter.X, roomMin.Y + 1.25f), roomMax.X - roomMin.X, 2.5f); allWalls.AddToSet(RoomWalls[3]); RoomWalls[3].Texture = "topWall"; DisplayWall = new XNACS1Rectangle(new Vector2(RoomCenter.X, roomMax.Y - 1.9f), roomMax.X - roomMin.X, 4.5f); DisplayWall.TopOfAutoDrawSet(); DisplayWall.Color = Color.Black; allWalls.AddToSet(DisplayWall); }
public void Update(Vector2 Center, int health, int maxHealth) { if (red != null && green != null) { red.RemoveFromAutoDrawSet(); green.RemoveFromAutoDrawSet(); red = null; green = null; } if (health >= (maxHealth * .7)) { red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f); red.Color = Color.Red; green = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f); green.Color = Color.Green; } else if (health >= (maxHealth * .4)) { red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f); red.Color = Color.Red; green = new XNACS1Rectangle(new Vector2(Center.X - 1, Center.Y + 3), 2, 0.5f); green.Color = Color.Green; } else if (health > 0) { red = new XNACS1Rectangle(new Vector2(Center.X, Center.Y + 3), 3, 0.5f); red.Color = Color.Red; green = new XNACS1Rectangle(new Vector2(Center.X - 2, Center.Y + 3), 1, 0.5f); green.Color = Color.Green; } }
public SmallHUD(Vector2 oDisplacement, int nOwner) { this.Width = fWidth; this.Height = fHeight; this.oDisplacement = oDisplacement; this.Texture = "SmallHUD2"; this.nOwner = nOwner; for (int x = 0; x < nScores.Count(); x++) { oScores[x] = new XNACS1Rectangle(); oScores[x].Color = new Color(0, 0, 0, 0); oScores[x].LabelColor = Color.White; oScores[x].LabelFont = "SmallHUD"; } oScoreDisplacments[0] = new Vector2(2.1f, 0f); oScoreDisplacments[1] = new Vector2(6.05f, 0f); oScoreDisplacments[2] = new Vector2(9.7f, 0f); oScoreDisplacments[3] = new Vector2(2.1f, -2.9f); oScoreDisplacments[4] = new Vector2(6.05f, -2.9f); oName = new XNACS1Rectangle(); oName.Color = new Color(0, 0, 0, 0); oName.LabelColor = Color.White; oName.Label = "BillyBobHobo"; oNameDisplacement = new Vector2(Global.PixelSize(45), Global.PixelSize(27)); oName.LabelFont = "SmallHUD"; }
public RobberMenu(int nCards) { this.Width = fWidth; this.Height = fHeight; this.Center = new Vector2(50f, 30f); this.Texture = "RobberMenu"; for (int x = 0; x < oCards.Count(); x++) { oCards[x] = new List <XNACS1Rectangle>(); oCardDisplacements[x] = new List <Vector2>(); } oButton = new XNACS1Rectangle(new Vector2(), Global.PixelSize(111), Global.PixelSize(34)); oButton.UseSpriteSheet = true; oButton.SetTextureSpriteSheet("TradeMenuButtons1", 3, 1, 0); oButton.SetTextureSpriteAnimationFrames(0, 0, 0, 0, 1, SpriteSheetAnimationMode.AnimateForward); oButton.LabelColor = Color.White; oButton.Label = "Accept"; oDiscardCount = new XNACS1Rectangle(new Vector2(), 5f, 5f); oDiscardCount.Color = new Color(0, 0, 0, 0); oDiscardCount.Label = "" + nDiscardsNeeded; oDiscardCount.LabelColor = Color.White; nDiscardsNeeded = (nCards / 2) + (nCards % 2); }
public void reflect(XNACS1Rectangle other) { if (other != null) { pushOutRectangle(other); reflectHelper(other); } }
public void reflect(XNACS1Rectangle other) { if (other != null) { pushOutRectangle(other); reflectionVelocityResolution(other); } }
public SpreadFireWeapon(Hero hero) : base(hero) { angledBullets = new Queue <XNACS1Circle>(); info = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 12, GameWorld.topEdge - 4), 4, 4); info.Color = Color.Blue; }
public PowerUp(Hero hero, float minX, float maxX) { this.hero = hero; float padding = hero.getPosition().Width * 2; float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding); float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding); box = new XNACS1Rectangle(new Vector2(randomX, randomY), width, width * 0.39f); }
public void init(Character character) { this.color = character.getColor(); XNACS1Rectangle charBox = character.getPosition(); this.box = new XNACS1Rectangle(charBox.Center, charBox.Width, charBox.Height); this.box.Color = this.color; box.AddToAutoDrawSet(); }
private bool contains(XNACS1Rectangle other) { float leftEdge = space.LowerLeft.X; float rightEdge = leftEdge + space.Width; float otherLeftEdge = other.MinBound.X; float otherRightEdge = otherLeftEdge + other.Width; return(otherLeftEdge > leftEdge && otherRightEdge < rightEdge); }
public Laser(Hero hero) { this.hero = hero; float height = GameWorld.topEdge - GameWorld.bottomEdge; float width = 1.5f; float padding = 1f; laserbeam = new XNACS1Rectangle(new Vector2(width / 2 + padding, height / 2), width, height); laserbeam.Color = new Color(Color.LightSkyBlue, 100); }
public MySoccer() { Texture = "SoccerBall"; Radius = 3f; ShouldTravel = true; Speed = 0.2f; mShowV = new XNACS1Rectangle(Center, Center + kDrawFactor * Velocity, kDrawWidth, null); mShowV.Color = Color.Blue; }
private float kDrawSize = 8f; // draw size ... public VectorComponents() { // Create first to show on bottom! mStart = new XNACS1Circle(); mStart.Radius = 0.5f; mStart.Color = Color.Black; mVec = new XNACS1Rectangle(); mTangent = new XNACS1Rectangle(); mNormal = new XNACS1Rectangle(); }
public void deleteRoom() { roomObjects.RemoveAllFromSet(); myDoors = null; myEnemies = null; walls = null; stairs = null; key = null; backGround.RemoveFromAutoDrawSet(); backGround = null; }
public ShipTile(float leftEdge) { float Xpos = leftEdge + (width * 0.5f); float Ypos = (Background.height / 2); Vector2 position = new Vector2(Xpos, Ypos); this.tile = new XNACS1Rectangle(position, width - gap, height); this.tile.Color = Color.DimGray; this.window = new XNACS1Rectangle(position, 1, 1); this.window.Color = Color.Gray; }
public Window(string label) { float width = XNACS1Base.World.WorldMax.X; float height = XNACS1Base.World.WorldMax.Y; Vector2 center = new Vector2(width / 2, height / 2); this.window = new XNACS1Rectangle(center, width / 3, height / 3); this.window.Color = new Color(Color.Gray, 50); this.window.LabelColor = Color.White; this.window.Label = label; }
public Character(Vector2 position, float width, float height) { this.position = new XNACS1Rectangle(position, width, height); this.position.Color = Game.randomColor(); this.nextPosition = new XNACS1Rectangle(position, width, height); this.nextPosition.Visible = false; // set object into motion; this.position.Velocity = new Vector2(0, 0); this.alive = true; this.pendingCollisions = new List <XNACS1Rectangle>(); }