/// <summary> /// Draws the buttons. /// </summary> public void DrawButtons() { SwinGame.DrawBitmap(SwinGame.BitmapNamed("Undo_active"), 600, 350); SwinGame.DrawBitmap(SwinGame.BitmapNamed("Replay_active"), 730, 350); SwinGame.DrawBitmap(SwinGame.BitmapNamed("Save1"), 600, 450); SwinGame.DrawBitmap(SwinGame.BitmapNamed("Mainmenu"), 600, 500); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); SwinGame.LoadFontNamed("GameFont", "Chunk.otf", 24); SwinGame.LoadFontNamed("TopFont", "Chunk.otf", 32); SwinGame.LoadFontNamed("StartFont", "Chunk.otf", 24); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.Red, "TopFont", 310, 105); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.White, "GameFont", 45, 40); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.White, "GameFont", 625, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 565, 225); } else { SwinGame.DrawText("No card played yet...", Color.Red, "StartFont", 10, 10); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 200, 230); //Draw onto the screen SwinGame.RefreshScreen(60); }
protected Bitmap MyBitmap() { switch (_kind) { case FruitKind.Cherry: return(SwinGame.BitmapNamed("Cherry")); case FruitKind.Gooseberry: return(SwinGame.BitmapNamed("Gooseberry")); case FruitKind.Blueberry: return(SwinGame.BitmapNamed("Blueberry")); case FruitKind.Pomegranate: return(SwinGame.BitmapNamed("Pomegranate")); case FruitKind.Apricot: return(SwinGame.BitmapNamed("Apricot")); case FruitKind.Raspberry: return(SwinGame.BitmapNamed("Raspberry")); case FruitKind.Blackberry: return(SwinGame.BitmapNamed("Blackberry")); case FruitKind.Strawberry: return(SwinGame.BitmapNamed("Strawberry")); case FruitKind.Currant: return(SwinGame.BitmapNamed("Currant")); default: return(SwinGame.BitmapNamed("Currant")); } }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); //change DrawGame method.. // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 350, 50); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 160, 50); //Draw onto the screen SwinGame.RefreshScreen(60); }
public BS_DiningTable() { //Dining Table SwinGame.LoadBitmapNamed("diningTable.png", "diningTable.png"); _diningTable = SwinGame.CreateSprite(SwinGame.BitmapNamed("diningTable.png")); // //initialize a food sprite without image _food = SwinGame.CreateSprite(SwinGame.BitmapNamed("")); //get a new customer _customer = BS_PokemonCustomerGenerator.NewCustomer(); //initialize Timer and start it for the first customer, set ticks to 0 and set the state of customer as waiting _gameTime = SwinGame.CreateTimer(); SwinGame.StartTimer(_gameTime); _ticks = 0; _waiting = true; // //initiate a new red status bar _statusBar = new BS_StatusBar("emptyThick.png"); _statusBar.SetFillingImage("redThick.png"); // }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); //SwinGame.ClearScreen(Color.White); //SwinGame.PlaySoundEffect("Start"); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.White, 340, 120); //SwinGame.DrawText ("Player 1 score: " + myGame.Score(0), Color.White, 130, 30); //SwinGame.DrawText ("Player 2 score: " + myGame.Score(1), Color.White, 130, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 570, 220); SwinGame.DrawText("" + myGame.Score(0), Color.White, "GameFont", 70, 50); SwinGame.DrawText("" + myGame.Score(1), Color.White, "GameFont", 758, 50); } else { SwinGame.DrawText("Hit space to start ...", Color.WhiteSmoke, 340, 120); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 200, 220); //Draw onto the screen SwinGame.RefreshScreen(60); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.ClearScreen(Color.White); // Draw the top card Card top = myGame.TopCard; if (top != null) { //SwinGame.DrawText ("Top hfgjhfjkgh gjfCard is " + top.ToString (), Color.RoyalBlue, 0, 20); //SwinGame.DrawText ("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); //SwinGame.DrawText ("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, "GameFont", 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, "GameFont", 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, "GameFont", 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 350, 50); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 160, 50); //Draw onto the screen SwinGame.RefreshScreen(60); }
public ZYSideBar(ViewManager viewManager) { _holdingFoodFrame = new ZYHoldingFoodFrame(); _viewManager = viewManager; _gameTime = SwinGame.CreateTimer(); SwinGame.StartTimer(_gameTime); winStar = 0; _life = 6; _gameLife = new ZYGameLife(); SwinGame.LoadBitmapNamed("side", "side_menu.png"); _sideBar = SwinGame.CreateSprite(SwinGame.BitmapNamed("side")); SwinGame.LoadBitmapNamed("star.png", "star.png"); SwinGame.LoadBitmapNamed("yellowStar.png", "yellowStar.png"); star1 = SwinGame.CreateSprite(SwinGame.BitmapNamed("star.png")); star2 = SwinGame.CreateSprite(SwinGame.BitmapNamed("star.png")); star3 = SwinGame.CreateSprite(SwinGame.BitmapNamed("star.png")); star4 = SwinGame.CreateSprite(SwinGame.BitmapNamed("yellowStar.png")); star5 = SwinGame.CreateSprite(SwinGame.BitmapNamed("yellowStar.png")); star6 = SwinGame.CreateSprite(SwinGame.BitmapNamed("yellowStar.png")); }
/// <summary> /// Draw background for specific state /// </summary> public static void DrawBackground() { switch (GameController.CurrentState) { case GameState.GameMenu: case GameState.GameMenuPaused: SwinGame.DrawBitmap(SwinGame.BitmapNamed("MenuBG"), 0, 0); SwinGame.DrawBitmap(SwinGame.BitmapNamed("SpaceWar"), 150, 60); break; case GameState.Tutorial: SwinGame.DrawBitmap(SwinGame.BitmapNamed("TutorialBG"), 0, 0); SwinGame.DrawBitmap(SwinGame.BitmapNamed("SpaceWar"), 150, 60); break; case GameState.HighScore: SwinGame.DrawBitmap(SwinGame.BitmapNamed("HighscoreBG"), 0, 0); SwinGame.DrawBitmap(SwinGame.BitmapNamed("SpaceWar"), 150, 60); break; case GameState.BattlePhrase: case GameState.Ending: SwinGame.DrawBitmap(SwinGame.BitmapNamed("BattleBG"), 0, 0); break; } }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.DrawBitmap("cardsBoard.png", 0, 0); SwinGame.LoadFontNamed("GameFont", "Chunkfive.regular.otf", 24); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); SwinGame.DrawText("" + myGame.Score(0), Color.White, "GameFont", 0, 60); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 521, 153); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 155, 153); //Draw onto the screen SwinGame.RefreshScreen(60); }
/// <summary> /// Evaluates the state of each Explosion Man. Two key events occur with Explosion Men: /// -When the Spawn Animation finishes, the explosion is created. /// -When the Explosion Animation finishes, the Entity is removed. /// This System checks the state and animation of each Explosion Man. /// </summary> public override void Process() { CExplosionMan explosion; CAnimation anim; CPosition pos; for (int i = Entities.Count - 1; i >= 0; i--) { anim = World.GetComponent <CAnimation>(Entities[i]); /// <summary> /// If one of the two key events are happening. /// </summary> if (SwinGame.AnimationEnded(anim.Anim)) { explosion = World.GetComponent <CExplosionMan>(Entities[i]); /// <summary> /// If not ready to explode, the Spawn animation has just finished. /// Therefore, create the explosion. /// </summary> if (!explosion.ReadyToExplode) { explosion.ReadyToExplode = true; pos = World.GetComponent <CPosition>(Entities[i]); /// <summary> /// Update size details as the Entity is now an Explosion. /// </summary> pos.Width = EntityFactory.EXPLOSION_SIZE; pos.Height = EntityFactory.EXPLOSION_SIZE; /// <summary> /// Adjust position details so explosion is in centre of the cell. /// </summary> CollisionCheckSystem collisions = World.GetSystem <CollisionCheckSystem>(); Point2D cellPos = collisions.CentreOfCell(explosion.TargetCell); pos.X = cellPos.X - (pos.Width / 2); pos.Y = cellPos.Y - (pos.Height / 2); /// <summary> /// Create explosion animation. /// </summary> anim.Img = SwinGame.BitmapNamed("Explosion"); SwinGame.AssignAnimation(anim.Anim, "Explode", anim.AnimScript); /// <summary> /// Add new components to the Entity. /// </summary> World.AddComponent(Entities[i], new CDamagesOnImpact(false)); World.AddComponent(Entities[i], new CDamage(EntityFactory.EXPLOSION_DAMAGE)); World.AddComponent(Entities[i], new CCollidable()); } else //If ready to explode, the Explode animation has just finished. Therefore, remove the Entity. { World.RemoveEntity(Entities[i]); } } } }
public void MarioSetFood(string foodImage) { SwinGame.LoadBitmapNamed(foodImage, foodImage); _mariofood = SwinGame.CreateSprite(SwinGame.BitmapNamed(foodImage)); SwinGame.SpriteSetX(_mariofood, _mariodiningTable.X + 20); SwinGame.SpriteSetY(_mariofood, _mariodiningTable.Y - 10); }
/// <summary> /// This runs via GameManager, through the game loop to iterate through enemy and laser lists and calls the collision check. /// </summary> /// <param name="w">Is a list of all laser shots.</param> /// <param name="e">Is a list of all enemies.</param> public void CheckCollisionWeaponEnemy(WeaponManager w, EnemyManager e) { List <WeaponInstance> weapons = w.WeaponList; List <IEnemy> enemies = e.EnemyList; foreach (WeaponInstance shot in weapons.ToList()) { foreach (IEnemy enemy in enemies.ToList()) { if (WeaponHitEnemy(shot, enemy)) { SwinGame.PlaySoundEffect("Explode"); if (shot.Type == SwinGame.BitmapNamed("laser")) { w.RemoveLaserCollision(shot); } enemies.Remove(enemy); SwinGame.DrawBitmap("explode", enemy.X, enemy.Y); GameData.Instance.Score += 1; _temp = enemy.Type; e.AddEnemyIfRemoved(_temp); } } } }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.ClearScreen(Color.White); SwinGame.DrawBitmap("cardsBoard.png", 0, 0); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.RoyalBlue, 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 565, 226); SwinGame.DrawText("" + myGame.Score(0), Color.White, "GameFont", 75, 50); // let the score color become white// SwinGame.DrawText("" + myGame.Score(1), Color.White, "GameFont", 765, 55); } else { SwinGame.DrawText("No card played yet...", Color.RoyalBlue, 0, 20); } SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 200, 225); // Draw the back of the cards... to represent the deck //Draw onto the screen SwinGame.RefreshScreen(60); }
public EnemyMedium(float x, float y) { X = x; Y = y; Speed = 8; Type = SwinGame.BitmapNamed("enemy2"); }
/// <summary> /// Draws the game to the Window. /// </summary> /// <param name="myGame">The details of the game -- mostly top card and scores.</param> private static void DrawGame(Snap myGame) { SwinGame.ClearScreen(Color.White); SwinGame.DrawBitmap("cardsBoard.png", 0, 0); // Draw the top card Card top = myGame.TopCard; if (top != null) { SwinGame.DrawText("Top Card is " + top.ToString(), Color.Black, "GameFont", 0, 20); SwinGame.DrawText("Player 1 score: " + myGame.Score(0), Color.Black, "GameFont", 0, 50); SwinGame.DrawText("Player 2 score: " + myGame.Score(1), Color.Black, "GameFont", 0, 80); SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), top.CardIndex, 521, 153); } else { SwinGame.DrawText("No card played yet...", Color.Black, "GameFont", 0, 20); } // Draw the back of the cards... to represent the deck SwinGame.DrawCell(SwinGame.BitmapNamed("Cards"), 52, 155, 153); //Draw onto the screen SwinGame.RefreshScreen(60); }
private static void LoadSprites() { Sprite blueDiamond = SwinGame.CreateSprite(SwinGame.BitmapNamed("diamondblue"), SwinGame.AnimationScriptNamed("diamondanimation")); _Sprites.Add("blueDiamond", blueDiamond); Sprite redDiamond = SwinGame.CreateSprite(SwinGame.BitmapNamed("diamondred"), SwinGame.AnimationScriptNamed("diamondanimation")); _Sprites.Add("redDiamond", redDiamond); Sprite yellowDiamond = SwinGame.CreateSprite(SwinGame.BitmapNamed("diamondyellow"), SwinGame.AnimationScriptNamed("diamondanimation")); _Sprites.Add("yellowDiamond", yellowDiamond); Sprite greenDiamond = SwinGame.CreateSprite(SwinGame.BitmapNamed("diamondgreen"), SwinGame.AnimationScriptNamed("diamondanimation")); _Sprites.Add("greenDiamond", greenDiamond); Sprite timerBlock = SwinGame.CreateSprite(SwinGame.BitmapNamed("diamondtimer"), SwinGame.AnimationScriptNamed("diamondanimation")); _Sprites.Add("timerBlock", timerBlock); Sprite rainbowDiamond = SwinGame.CreateSprite(SwinGame.BitmapNamed("diamondrainbow"), SwinGame.AnimationScriptNamed("diamondanimation")); _Sprites.Add("rainbowDiamond", rainbowDiamond); SwinGame.SpriteStartAnimation(_Sprites["blueDiamond"], "spinningdiamond"); SwinGame.SpriteStartAnimation(_Sprites["redDiamond"], "spinningdiamond"); SwinGame.SpriteStartAnimation(_Sprites["yellowDiamond"], "spinningdiamond"); SwinGame.SpriteStartAnimation(_Sprites["greenDiamond"], "spinningdiamond"); SwinGame.SpriteStartAnimation(_Sprites["timerBlock"], "spinningdiamond"); SwinGame.SpriteStartAnimation(_Sprites ["rainbowDiamond"], "spinningdiamond"); }
/// <summary> /// Updates all the movements and collisions. /// </summary> public void Update() { _player.MoveShip(); UpdatePlayerLife(); _collision.CheckCollisionEnemyPlayer(_player, _enemyManager); _collision.CheckCollisionWeaponEnemy(_player.Weapon, _enemyManager); if (SwinGame.KeyTyped(KeyCode.SpaceKey)) { _shotType = SwinGame.BitmapNamed("laser"); _player.Shoot(_shotType); SwinGame.RefreshScreen(); if (_player.Weapon.Shots > 0) { _player.Weapon.Shots -= 1; } } if (GameData.Instance.Score >= 7) { if (SwinGame.KeyTyped(KeyCode.SKey)) { _shotType = SwinGame.BitmapNamed("laserSpec"); _player.Shoot(_shotType); GameData.Instance.Score -= 2; SwinGame.RefreshScreen(); } } if (SwinGame.KeyTyped(KeyCode.RKey) && _player.Weapon.Shots <= 5) { _player.Weapon.ReloadLaser(); } }
public MWMarioDiningTable() { //Dining Table SwinGame.LoadBitmapNamed("diningTable.png", "diningTable.png"); _mariodiningTable = SwinGame.CreateSprite(SwinGame.BitmapNamed("diningTable.png")); // //initialize a food sprite without image _mariofood = SwinGame.CreateSprite(SwinGame.BitmapNamed("")); //get a new customer _mariocustomer = MWMarioCustomerGenerator.NewMarioCustomer(); //initialize Timer and start it for the first customer, set ticks to 0 and set the state of customer as waiting _mariogameTime = SwinGame.CreateTimer(); SwinGame.StartTimer(_mariogameTime); _marioticks = 0; _mariowaiting = true; // //initiate a new red status bar _mariostatusBar = new MWStatusBar("emptyThick.png"); _mariostatusBar.SetFillingImage("redThick.png"); // }
//Set the food by using food name public void SetFood(string foodName) { _foodName = foodName; SwinGame.LoadBitmapNamed(_foodName, _foodName); _food = SwinGame.CreateSprite(SwinGame.BitmapNamed(_foodName)); SwinGame.SpriteSetX(_food, _tableOfStove.X + 25); SwinGame.SpriteSetY(_food, _tableOfStove.Y - 10); }
/// <summary> /// Draw the menu /// </summary> public void Draw() { SwinGame.DrawBitmap(SwinGame.BitmapNamed("Background"), 0, 0); SwinGame.DrawBitmap(SwinGame.BitmapNamed("Newgame"), TOP_BUTTON_X, TOP_BUTTON_Y); SwinGame.DrawBitmap(SwinGame.BitmapNamed("Loadgame"), MIDDLE_BUTTON_X, MIDDLE_BUTTON_Y); SwinGame.DrawBitmap(SwinGame.BitmapNamed("Quit"), BELOW_MIDDLE_X, BELOW_MIDDLE_Y); SwinGame.DrawBitmap(SwinGame.BitmapNamed("AI"), BOTTOM_BUTTON_X, BOTTOM_BUTTON_Y); }
public void SetFood(string foodName) { _foodName = foodName; SwinGame.LoadBitmapNamed(foodName, foodName); _holdingFood = SwinGame.CreateSprite(SwinGame.BitmapNamed(foodName)); SwinGame.SpriteSetX(_holdingFood, 383); SwinGame.SpriteSetY(_holdingFood, 178); }
public EnemySlow(float x, float y, Player player) { X = x; Y = y; _player = player; Speed = 5; Type = SwinGame.BitmapNamed("enemy1"); }
public static Bitmap AddBitmap(string imageName, string BitmapName) { string NewBitmapPath = Directory.GetCurrentDirectory() + imageDirectory + imageName; //NewBitmapPath = DirectoryLocation + imageDirectory + imageName; SwinGame.LoadBitmapNamed(BitmapName, NewBitmapPath); return(SwinGame.BitmapNamed(BitmapName)); }
// Gets an Image currently loaded in the Resources public static Bitmap GameImage(string image) { //return _Images(image); if (_toggle) { image += "1"; } return(SwinGame.BitmapNamed(image)); }
/// <summary> /// Creates a firework sprite for the game ending. /// </summary> /// <returns>A sprite with the firework data</returns> public Sprite createFireWork() { Sprite sprite = SwinGame.CreateSprite(SwinGame.BitmapNamed("fireworksBmp"), SwinGame.AnimationScriptNamed("fireworksScrpt")); SwinGame.SpriteStartAnimation(sprite, "firework_start"); SwinGame.SpriteSetX(sprite, rand.Next(10, 790)); SwinGame.SpriteSetY(sprite, rand.Next(10, 250)); return(sprite); }
/// <summary> /// Creates a visual healing effect /// </summary> /// <returns>The effect.</returns> /// <param name="hero">Hero.</param> public Sprite createEffect(Unit hero) { Sprite sprite = SwinGame.CreateSprite(SwinGame.BitmapNamed("effectsBmp"), SwinGame.AnimationScriptNamed("healingScrpt")); SwinGame.SpriteStartAnimation(sprite, "healing_effect"); SwinGame.SpriteSetX(sprite, hero.getX() - 70); SwinGame.SpriteSetY(sprite, hero.getY() - 80); return(sprite); }
public ZYCustomer(string image) { //customer sprite SwinGame.LoadBitmapNamed(image, image); _customer = SwinGame.CreateSprite(SwinGame.BitmapNamed(image)); // //get new wish from Wish Generator _wish = ZYWishGenerator.NewWish(); }
public UI_PlayerSelectTemplate(A3RData a3RData, endSelectStage endSelectStage) : base(a3RData) { _endSelectStage = endSelectStage; _menuLogo = new UI_StaticImage(Camera, Width(0.45f), Height(0.14f), SwinGame.BitmapNamed("menuLogo")); AddElement(_menuLogo); }
/// <summary> /// A Constructor without the animation details /// </summary> public Projectile(string bitmap, float projectileSpeed, Unit unit) { this.unit = unit; this.projectileSpeed = projectileSpeed; sprite = SwinGame.CreateSprite (SwinGame.BitmapNamed (bitmap)); SwinGame.SpriteSetX (sprite, unit.getX()+10); SwinGame.SpriteSetY (sprite, unit.getY()); SwinGame.SpriteSetDX (sprite, projectileSpeed); }