private static void AddAnimation1(int row, int col, string image)
    {
        Sprite s      = default(Sprite);
        Bitmap imgObj = default(Bitmap);

        imgObj = GameResources.GameImage(image);
        imgObj.SetCellDetails(40, 40, 3, 3, 35);

        AnimationScript animation = default(AnimationScript);

        animation = SwinGame.LoadAnimationScript("HitExplosion.txt");

        s   = SwinGame.CreateSprite(imgObj, animation);
        s.X = FIELD_LEFT + col * (CELL_WIDTH + CELL_GAP);
        s.Y = FIELD_TOP + row * (CELL_HEIGHT + CELL_GAP);

        s.StartAnimation("HitExplosion");
        _Animations.Add(s);
    }
예제 #2
0
    private static void AddAnimation(int row, int col, string image)
    {
        Sprite s;
        Bitmap imgObj;

        imgObj = GameResources.GameImage(image);
        imgObj.SetCellDetails(40, 40, 3, 3, 7);

        AnimationScript animation;

        animation = SwinGame.LoadAnimationScript("splash.txt");

        s   = SwinGame.CreateSprite(imgObj, animation);
        s.X = FIELD_LEFT + (col * (CELL_WIDTH + CELL_GAP));
        s.Y = FIELD_TOP + (row * (CELL_HEIGHT + CELL_GAP));

        s.StartAnimation("splash");
        _Animations.Add(s);
    }
    private static void AddAnimation(int row, int col, string image)
    {
        Sprite s;
        Bitmap imgObj;

        imgObj = GameImage(image);
        imgObj.SetCellDetails(40, 40, 3, 3, 7);

        AnimationScript animation;

        animation = SwinGame.LoadAnimationScript("splash.txt");

        s   = SwinGame.CreateSprite(imgObj, animation);
        s.X = Field_Left + col * (Cell_Width + Cell_Gap);
        s.Y = Field_Top + row * (Cell_Height + Cell_Gap);

        s.StartAnimation("splash");
        _Animations.Add(s);
    }
예제 #4
0
        public ZYBottomBar()
        {
            //make the initial selection to NULL
            _selection = "";

            //for observer pattern
            _stove = new List <ZYStove> ();

            //Background
            SwinGame.LoadBitmapNamed("btm_background", "btm_background.jpg");
            _bottomBarBackground = SwinGame.CreateSprite(SwinGame.BitmapNamed("btm_background"));
            //

            //initialize 4 sample food
            _sampleFood     = new ZYSampleFood [3];
            _sampleFood[0]  = new ZYSampleFood("BlueCandy.png");
            _sampleFood [1] = new ZYSampleFood("GreenCandy.png");
            _sampleFood [2] = new ZYSampleFood("RedCandy.png");
            //
        }
        public ZYCharacterInterface(ViewManager viewManager) : base(viewManager)
        {
            //background Image
            _image = "characterSelectionBackground.jpg";
            SwinGame.LoadBitmapNamed(_image, _image);
            _menu = SwinGame.CreateSprite(SwinGame.BitmapNamed(_image));
            //

            //Male Button
            _maleButton = new ZYButton("grey_button06.png");
            _maleButton.SetWidth(191);
            _maleButton.SetHeight(49);
            _maleButton.SetText(" Male ", 25);
            //

            _femaleButton = new ZYButton("grey_button06.png");
            _femaleButton.SetWidth(191);
            _femaleButton.SetHeight(49);
            _femaleButton.SetText(" Female ", 25);
        }
예제 #6
0
        /// <summary>
        /// Defines what units need to be units and sets up essential features for each unit(e.g animation)
        /// </summary>
        /// <param name="bitmap">An image of the character</param>
        /// <param name="animation">The name of the animation used</param>
        /// <param name="movementSpeed">How fast the unit moves</param>
        /// <param name="dmg">How much dmg units output</param>
        /// <param name="enemy">If the unit is an enemy</param>
        /// <remarks>
        /// The enemy flag makes the <seealso cref="MovementDirection"/> redundant as this flag can be checked to dictate movement.
        /// </remarks>
        public Unit(string bitmap, string animation, float movementSpeed, float dmg, bool enemy)
        {
            this.movementSpeeed = movementSpeed;
            sprite = SwinGame.CreateSprite(SwinGame.BitmapNamed(bitmap), SwinGame.AnimationScriptNamed(animation));
            SwinGame.SpriteStartAnimation(sprite, "walking_loop");

            if (enemy)
            {
                SwinGame.SpriteSetX(sprite, Position.ENEMY_SPAWN_X);
                SwinGame.SpriteSetY(sprite, Position.ENEMY_SPAWN_Y);
            }
            else
            {
                SwinGame.SpriteSetX(sprite, Position.HERO_SPAWN_X);
                SwinGame.SpriteSetY(sprite, Position.HERO_SPAWN_Y);
            }

            SwinGame.SpriteSetDX(sprite, movementSpeed);
            this.dmg = dmg;
        }
        public MWCustomerSelection(ViewManager viewManager) : base(viewManager)
        {
            //background Image
            _image = BS_bgSelector.bg_img();
            SwinGame.LoadBitmapNamed(_image, _image);
            _menu = SwinGame.CreateSprite(SwinGame.BitmapNamed(_image));
            //

            //Male Button
            _pokemonButton = new MWButton("grey_button06.png");
            _pokemonButton.SetWidth(191);
            _pokemonButton.SetHeight(49);
            _pokemonButton.SetText("Pokemon", 25);
            //

            _superMarioButton = new MWButton("grey_button06.png");
            _superMarioButton.SetWidth(191);
            _superMarioButton.SetHeight(49);
            _superMarioButton.SetText("SuperMario", 25);
        }
        public Menu(ViewManager viewManager) : base(viewManager)
        {
            _backgroundImage = BS_bgSelector.bg_img();
            SwinGame.LoadBitmapNamed(_backgroundImage, _backgroundImage);
            _menu = SwinGame.CreateSprite(SwinGame.BitmapNamed(_backgroundImage));

            _startButton = new ZYButton("grey_button06.png");
            _startButton.SetWidth(191);
            _startButton.SetHeight(49);
            _startButton.SetText("     Start     ", 33);

            _settingsButton = new BS_Button("grey_button06.png");
            _settingsButton.SetWidth(191);
            _settingsButton.SetHeight(49);
            _settingsButton.SetText("   Settings  ", 33);

            _instructionButton = new ZYButton("grey_button06.png");
            _instructionButton.SetWidth(191);
            _instructionButton.SetHeight(49);
            _instructionButton.SetText(" Instruction ", 33);
        }
예제 #9
0
        public World(Rectangle windowRect, InputHandler inputHandler)
        {
            _windowRect = windowRect;
            UserInterface.Instance.World = this;
            _camera           = UserInterface.Instance.Camera;
            _cameraFocusPoint = new CameraFocusPoint();
            _logicalTerrain   = new Terrain(_windowRect);
            _environment      = new Environment(_windowRect, _camera);
            _inputHandler     = inputHandler;
            _players          = new List <Player>();
            _selectedPlayer   = null;
            _state            = new StateComponent <WorldState>(WorldState.TrackingPlayer); //change to loading later
            _observer         = new WorldObserver(this);
            _random           = new Random();

            _windMarker = SwinGame.CreateSprite(SwinGame.BitmapNamed("windMarker"));

            _satellite = new Satellite("Maia", Constants.TerrainWidth / 2, -300);



            _turnCount = 0;
        }
        public BS_Stove(BS_TableOfStove tableOfStove)
        {
            //set the food to cook to null and cooking state as false
            _foodToCook = "";
            _cooking    = false;
            //

            //bind the table
            _tableOfStove = tableOfStove;

            //create the stove SPRITE
            SwinGame.LoadBitmapNamed("stove", "stove.png");
            _stove = SwinGame.CreateSprite(SwinGame.BitmapNamed("stove"));
            //

            //initiate _gameTime
            _gameTime = SwinGame.CreateTimer();

            //initiate new BlUE status bar
            _statusBar = new BS_StatusBar("emptyThick.png");
            _statusBar.SetFillingImage("blueThick.png");
            //
        }
예제 #11
0
        public void GenerateBlock2()
        {
            List <ColorBlock> colorBlocks = new List <ColorBlock> ();
            BlockFactory      myFactory = new BlockFactory();
            int a = 12, b = 12;             //a for x position, b for y position of blocks

            while (b < 500)
            {
                for (int x = 0; x < 9; x++)
                {
                    for (int y = 0; y < 9; y++)
                    {
                        if (_blocks [x, y] == null || _blocks [x, y].Color == Color.Black)
                        {
                            colorBlocks.Add(_blocks [x, y]);
                            AddBlock(x, y, myFactory.CreateRandBlock(a, b));
                        }
                        else if (_blocks [x, y].Color == Color.Wheat)
                        {
                            colorBlocks.Add(_blocks [x, y]);
                            AddBlock(x, y, myFactory.CreateTimerBlock(a, b));
                        }
                        else if (_blocks [x, y].Color == Color.Grey)
                        {
                            colorBlocks.Add(_blocks [x, y]);
                            AddBlock(x, y, myFactory.CreateRainbowBlock(a, b));
                        }

                        //increment x position
                        a += 59;
                    }

                    //reset x position to 12 and increment y position
                    a  = 12;
                    b += 69;
                }
            }
            List <Sprite> _destroyedSprites = new List <Sprite> ();
            Sprite        sprite            = SwinGame.CreateSprite(SwinGame.BitmapNamed("destroyedani"), SwinGame.AnimationScriptNamed("destroyedanimation"));

            foreach (ColorBlock block in colorBlocks)
            {
                sprite = SwinGame.CreateSprite(SwinGame.BitmapNamed("destroyedani"), SwinGame.AnimationScriptNamed("destroyedanimation"));
                SwinGame.SpriteStartAnimation(sprite, "dematerialize");
                SwinGame.SpriteSetX(sprite, block.X - 20);
                SwinGame.SpriteSetY(sprite, block.Y - 15);
                _destroyedSprites.Add(sprite);
            }

            if (!sprite.AnimationHasEnded)
            {
                SwinGame.PlaySoundEffect(UIController.GameSound("explosion"));
                SwinGame.PauseTimer("timer");
            }

            do
            {
                //SwinGame.DrawAllSprites();
                foreach (Sprite _sprite in _destroyedSprites)
                {
                    SwinGame.DrawSprite(_sprite);
                }
                SwinGame.RefreshScreen(60);
                SwinGame.UpdateAllSprites();
            } while(!sprite.AnimationHasEnded);

            if (sprite.AnimationHasEnded && UIController.TimerPaused == false)
            {
                SwinGame.ResumeTimer("timer");
            }
        }
 public ZYPlayer()
 {
     _movement        = new ZYMovement();
     _holdingFoodName = "";
     _player          = SwinGame.CreateSprite(SwinGame.BitmapNamed(_image), SwinGame.AnimationScriptNamed("WalkingScript"));
 }
 public void NewEnergyBall()
 {
     _energyImage = "poop.png";
     SwinGame.LoadBitmapNamed(_energyImage, _energyImage);
     _energyBall = SwinGame.CreateSprite(SwinGame.BitmapNamed(_energyImage));
 }
 public void ResetEnergyBall()
 {
     _energyImage = "";
     SwinGame.LoadBitmapNamed(_energyImage, _energyImage);
     _energyBall = SwinGame.CreateSprite(SwinGame.BitmapNamed(_energyImage));
 }
 public ZYEnergyBall()
 {
     _energyImage = "ball.png";
     SwinGame.LoadBitmapNamed(_energyImage, _energyImage);
     _energyBall = SwinGame.CreateSprite(SwinGame.BitmapNamed(_energyImage));
 }
예제 #16
0
 public ZYButton(string buttonImage)
 {
     SwinGame.LoadBitmapNamed(buttonImage, buttonImage);
     _button = SwinGame.CreateSprite(SwinGame.BitmapNamed(buttonImage));
 }
 public ZYStatusBar(string emptyBar)
 {
     SwinGame.LoadBitmapNamed(emptyBar, emptyBar);
     _statusBar = SwinGame.CreateSprite(SwinGame.BitmapNamed(emptyBar));
 }
 public BS_EnergyBall()
 {
     _energyImage = "GainPack.png";
     SwinGame.LoadBitmapNamed(_energyImage, _energyImage);
     _energyBall = SwinGame.CreateSprite(SwinGame.BitmapNamed(_energyImage));
 }