Beispiel #1
0
 public Block(string name, TextureData textureData,
             SpritePresentationInfo spritePresentationInfo,
                 SpritePositionInfo spritePositionInfo)
     : base(name, textureData, spritePresentationInfo, spritePositionInfo)
 {
     this.health = 5;
 }
Beispiel #2
0
 public Cloud(float speed, string name, TextureData textureData,
             SpritePresentationInfo spritePresentationInfo,
                 SpritePositionInfo spritePositionInfo)
     : base(name, textureData, spritePresentationInfo, spritePositionInfo)
 {
     this.speed = speed;
     this.moveAmount = 0;
 }
Beispiel #3
0
        public Sprite(string name, TextureData textureData, 
                    SpritePresentationInfo spritePresentationInfo,
                        SpritePositionInfo spritePositionInfo)
        {
            this.name = name;
            this.textureData = textureData;
            this.spritePresentationInfo = spritePresentationInfo;
            this.spritePositionInfo = spritePositionInfo;

            //make sure we set first time around
            this.sectorNumber = Collision.getSectorNumber(this.POSITIONINFO.BOUNDS);
        }
        /*
         * Student should change this code to indicate the depth of each loaded sprite.
         * The logic of how your game instanciates different sprite types at different levels is contained in this method.
         * */
        private static Block getSprite(SpritePositionInfo PositionInfo, TextureData textureData, int textureNumber, int tileWidth, int tileHeight)
        {
            Block sprite = null;

                //think this should be static if we leave like this.

                //use layer depth to say what things dont receive light e.g. textureNumber > 20 set layerDepth = 0.5 - See RenderScene pixel shader for depth value
             //   float layerDepth = 1;
                //use textureNumber to specify what types of sprite to create e.g. PlayerSprite, Moveable
                if (textureNumber == 1)
                {
                    SpritePresentationInfo PresentationInfo = new SpritePresentationInfo(new Rectangle(60, 60, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);
                }
                else if (textureNumber == 2)
                {
                    SpritePresentationInfo PresentationInfo = new SpritePresentationInfo(new Rectangle(480, 120, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);
                }
                else if (textureNumber == 4)
                {
                    SpritePresentationInfo PresentationInfo = new SpritePresentationInfo(new Rectangle(60, 60, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);
                }
                else if (textureNumber == 6)
                {

                    SpritePresentationInfo PresentationInfo = new SpritePresentationInfo(new Rectangle(0, 0, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);

                }
                else if (textureNumber == 8)
                {

                    SpritePresentationInfo PresentationInfo =  new SpritePresentationInfo(new Rectangle(0, 0, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);
                }
                else if (textureNumber == 9)
                {

                    SpritePresentationInfo PresentationInfo = new SpritePresentationInfo(new Rectangle(0, 0, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);
                }
                else if (textureNumber == 10)
                {

                    SpritePresentationInfo PresentationInfo = new SpritePresentationInfo(new Rectangle(0, 0, tileWidth, tileHeight), backDepth);
                    sprite = new Block("Tile" + i, textureData, PresentationInfo, PositionInfo);
                }
                else
                {
                    return null;
                }

                i++;
                return sprite;
        }