Data class for state.
Inheritance: IRpgObject
Esempio n. 1
0
        public Sprite(State gameState, float x, float y, string filename)
        {
            //Load the bitmap
            _frames.Add(new Bitmap(filename));

            //Set the location and use the height and width from the 1st frame
            initialize(gameState, x, y, _frames[0].Width, _frames[0].Height);
        }
Esempio n. 2
0
        public GameDisplay()
        {
            //Setup the form
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);

            //Startup the game state
            _gameState = new State(ClientSize);

            initialize();
        }
Esempio n. 3
0
        public Sprite(State gameState, float x, float y, Bitmap bitmap, Rectangle rectangle, int numberAnimationFrames)
        {
            for (int i = 0; i < numberAnimationFrames; i++)
                {
                    //if (i<3)_walking.Add(bitmap);
                    //else if (i < 6) _walkingdown.Add(bitmap);
                    //else _walkingup.Add(bitmap);
                    _frames.Add(bitmap);
                    initialize(gameState, x, y, rectangle.Width / numberAnimationFrames, rectangle.Height);

                    _rectangle.Add(new Rectangle(rectangle.X + i * rectangle.Width / numberAnimationFrames, rectangle.Y,
                                                  rectangle.Width / numberAnimationFrames, rectangle.Height));
                }
        }
Esempio n. 4
0
        public GameWorld(State gameState, Dictionary<string, Tile> tiles, string mapFile)
        {
            _gameState = gameState;
            _tiles = tiles;

            //Read in the map file
            readMapfile(mapFile);

            //Find the start point
            _currentArea = _world[_startArea];

            //Create and position the hero character
            _heroPosition = new Point(3, 3);
            _heroSprite = new Sprite(null, _heroPosition.X * Tile.TileSizeX + LocalArea.OffsetX,
                                            _heroPosition.Y * Tile.TileSizeY + LocalArea.OffsetY,
                                            _tiles["sha"].Bitmap, _tiles["sha"].Rectangle, _tiles["sha"].NumberOfFrames);
            _heroSprite.Flip = true;
            _heroSprite.ColorKey = Color.FromArgb(75, 75, 75);
        }
Esempio n. 5
0
 private void DataObjectListIndexChanged(object sender, EventArgs e)
 {
     int index = this.dataObjectList.SelectedIndex;
     if (index < 0) return;
     this._state = this.Data[index + 1];
     this.RefreshCurrentObject();
 }
Esempio n. 6
0
 private void initialize(State gameState, float x, float y, float width, float height)
 {
     _gameState = gameState;
     Location.X = x;
     Location.Y = y;
     Size.Width = width;
     Size.Height = height;
     CurrentFrame = 0;
 }