setFrameSet() public method

public setFrameSet ( DIRECTION d, List sheetRefs ) : void
d DIRECTION
sheetRefs List
return void
        private void setupPlayer()
        {
            List<TileRef> playerFrames = new List<TileRef>();
            playerFrames.Add(new TileRef(15, 0, 0));
            playerFrames.Add(new TileRef(16, 0, 0));
            playerFrames.Add(new TileRef(17, 0, 0));
            playerFrames.Add(new TileRef(18, 0, 0));
            playerFrames.Add(new TileRef(19, 0, 0));
            playerFrames.Add(new TileRef(20, 0, 0));
            playerFrames.Add(new TileRef(21, 0, 0));

            player = new PlayerWithWeapon(new Vector2(0, 0), new Vector2(tileMap.GetLength(1),tileMap.GetLength(0)),
                            playerFrames,
                            64, 64, 1.0f); // Default stopped

            player.setFrameSet(DIRECTION.UP, playerFrames);
            player.setFrameSet(DIRECTION.DOWN,
                new List<TileRef> {
                    new TileRef(15, 1, 0),
                    new TileRef(16, 1, 0),
                    new TileRef(17, 1, 0),
                    new TileRef(18, 1, 0),
                    new TileRef(19, 1, 0),
                    new TileRef(20, 1, 0),
                    new TileRef(21, 1, 0),
            });
            player.setFrameSet(DIRECTION.LEFT,
                new List<TileRef> {
                    new TileRef(16, 2, 0),
                    new TileRef(16, 3, 0),
                    new TileRef(16, 4, 0),
                    new TileRef(16, 5, 0),
                    new TileRef(16, 6, 0),
                    new TileRef(16, 7, 0),
                    new TileRef(16, 8, 0),
            });
            player.setFrameSet(DIRECTION.RIGHT,
                new List<TileRef> {
                    new TileRef(15, 2, 0),
                    new TileRef(15, 3, 0),
                    new TileRef(15, 4, 0),
                    new TileRef(15, 5, 0),
                    new TileRef(15, 6, 0),
                    new TileRef(15, 7, 0),
                    new TileRef(15, 8, 0),
            });
        }
Ejemplo n.º 2
0
        private void setupPlayer()
        {
            List<TileRef> playerFrames = new List<TileRef>();
            playerFrames.Add(new TileRef(15, 0, 0));
            playerFrames.Add(new TileRef(16, 0, 0));
            playerFrames.Add(new TileRef(17, 0, 0));
            playerFrames.Add(new TileRef(18, 0, 0));
            playerFrames.Add(new TileRef(19, 0, 0));
            playerFrames.Add(new TileRef(20, 0, 0));
            playerFrames.Add(new TileRef(21, 0, 0));

            player = new PlayerWithWeapon(new Vector2(0, 0), new Vector2(tileMap.GetLength(1),tileMap.GetLength(0)),
                            playerFrames,
                            64, 64, 0f); // Default stopped

            player.setFrameSet(DIRECTION.UP, playerFrames);
            player.setFrameSet(DIRECTION.DOWN,
                new List<TileRef> {
                    new TileRef(15, 1, 0),
                    new TileRef(16, 1, 0),
                    new TileRef(17, 1, 0),
                    new TileRef(18, 1, 0),
                    new TileRef(19, 1, 0),
                    new TileRef(20, 1, 0),
                    new TileRef(21, 1, 0),
            });
            player.setFrameSet(DIRECTION.LEFT,
                new List<TileRef> {
                    new TileRef(16, 2, 0),
                    new TileRef(16, 3, 0),
                    new TileRef(16, 4, 0),
                    new TileRef(16, 5, 0),
                    new TileRef(16, 6, 0),
                    new TileRef(16, 7, 0),
                    new TileRef(16, 8, 0),
            });
            player.setFrameSet(DIRECTION.RIGHT,
                new List<TileRef> {
                    new TileRef(15, 2, 0),
                    new TileRef(15, 3, 0),
                    new TileRef(15, 4, 0),
                    new TileRef(15, 5, 0),
                    new TileRef(15, 6, 0),
                    new TileRef(15, 7, 0),
                    new TileRef(15, 8, 0),
            });

            // Load the players newly created projectile
            player.loadProjectile(
                new Projectile(player.Tileposition,
                new List<TileRef>() // projectile tiles
                {
                    new TileRef(3,0,0),
                    new TileRef(4,0,0),
                    new TileRef(5,0,0),
                    new TileRef(6,0,0),
                },
                new List<TileRef>() // explosion tiles
                {
                    new TileRef(0,0,0),
                    new TileRef(1,0,0),
                    new TileRef(2,0,0),
                }, tileWidth, tileHeight, 0.5f));
        }