Пример #1
0
        public Player(string name, List<AnimatedTextureData> animationsList,
                    SpritePresentationInfo spritePresentationInfo,
                    SpritePositionInfo spritePositionInfo,
                    int frameRate)
            : base(name, animationsList,
                    spritePresentationInfo,
                    spritePositionInfo,
                    frameRate)
        {
            this.moveAmount = 0;
            this.velocity = Vector2.Zero;
            this.acceleration = 0.0015f;
            this.direction = Vector2.Zero;
            this.gravity = 0.0025f;
            this.jumpPower = 1.6f;
            this.springJumpPower = 2f;
            this.oldPos = new Vector2(spritePositionInfo.TRANSLATIONX, spritePositionInfo.TRANSLATIONY);
            this.hasKey = false;
            this.coins = 0;
            this.health = 3; // 3 health? 3 hearts?
            this.invulnerable = false;
            this.invulnerableTimer = 0;

            this.levelStartPos = spritePositionInfo.TRANSLATION;

            this.coinsTaken = new List<Block>();
            this.keysTaken = new List<Block>();

            this.jump = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("jump");
            this.pickup = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("pickup");
            this.hurt = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("hurt");
            this.endGame = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("endGame");
        }
Пример #2
0
 public DynamicBlock(string name, List<AnimatedTextureData> animationsList,
             SpritePresentationInfo spritePresentationInfo,
             SpritePositionInfo spritePositionInfo,
             int frameRate)
     : base(name, animationsList, spritePresentationInfo, spritePositionInfo, frameRate)
 {
 }
Пример #3
0
 public Block(string name, TextureData textureData,
             SpritePresentationInfo spritePresentationInfo,
                 SpritePositionInfo spritePositionInfo)
     : base(name, textureData, spritePresentationInfo, spritePositionInfo)
 {
     this.health = 5;
 }
Пример #4
0
 public Cloud(float speed, string name, TextureData textureData,
             SpritePresentationInfo spritePresentationInfo,
                 SpritePositionInfo spritePositionInfo)
     : base(name, textureData, spritePresentationInfo, spritePositionInfo)
 {
     this.speed = speed;
     this.moveAmount = 0;
 }
 //for some of the values to be passed into AnimatedSprite I took them out and assumed they
 //would use "generic values". Especially for the repeat bool, it would cause trouble if
 //set to false. Could extend it further to return to "base" animaiton when dont with an
 //animation if needed.
 //(Current implementation would remove the sprite after one animation is done if
 //set to fasle)
 public ModularAnimatedSprite(string name, List<AnimatedTextureData> animationsList,
             SpritePresentationInfo spritePresentationInfo,
             SpritePositionInfo spritePositionInfo,
             int frameRate)
     : base(name, animationsList[0], spritePresentationInfo, spritePositionInfo,
         frameRate, 0, true)
 {
     this.animationsList = animationsList;
     this.currentAnimation = 0;
 }
Пример #6
0
 public Enemy(Vector2 startPoint, Vector2 endPoint, int numberOfSteps, string name, List<AnimatedTextureData> animationsList,
             SpritePresentationInfo spritePresentationInfo,
             SpritePositionInfo spritePositionInfo,             
             int frameRate)
     : base(name, animationsList, spritePresentationInfo, spritePositionInfo, frameRate)
 {
     this.startPoint = startPoint;
     this.endPoint = endPoint;
     this.numberOfSteps = numberOfSteps;
     this.step = (endPoint - startPoint) / numberOfSteps;
 }
Пример #7
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);
        }
Пример #8
0
        public AnimatedSprite(string name, AnimatedTextureData animatedTextureData,
                    SpritePresentationInfo spritePresentationInfo,
                        SpritePositionInfo spritePositionInfo,
                            int frameRate, int startFrame, bool bRepeatAnimation)
            : base(name, animatedTextureData, spritePresentationInfo, spritePositionInfo)
        {
            this.animatedTextureData = animatedTextureData;// (AnimatedTextureData)animatedTextureData.Clone();
            this.TEXTUREDATA.TEXTURECOLORDATA2D = animatedTextureData[0];

            this.frameRate = frameRate;
            timeBetweenFrameInMs = 1000.0 / frameRate; //time between each frame if they play at frameRate per second (e.g. 24fps gives timeBetweenFrameInMs = 1000ms/24 per second)
            timeSinceLastFrameInMs = timeBetweenFrameInMs; //means no initial delay in animation
            this.startFrame = startFrame;
            currentFrame = startFrame;
            this.bRepeatAnimation = bRepeatAnimation;
        }
Пример #9
0
        public Player(string name, List<AnimatedTextureData> animationsList,
                    SpritePresentationInfo spritePresentationInfo,
                    SpritePositionInfo spritePositionInfo,
                    int frameRate)
            : base(name, animationsList,
                    spritePresentationInfo,
                    spritePositionInfo,
                    frameRate)
        {
            this.moveAmount = 0;
            this.velocity = Vector2.Zero;
            this.acceleration = 0.0015f;
            this.direction = Vector2.Zero;
            this.gravity = 0.0025f;
            this.jumpPower = 1.6f;
            this.springJumpPower = 2f;
            this.oldPos = new Vector2(spritePositionInfo.TRANSLATIONX, spritePositionInfo.TRANSLATIONY);
            this.hasKey = false;
            this.coins = 0;
            this.health = 4; // 3 health? 3 hearts?
            this.invulnerable = false;
            this.invulnerableTimer = 0;

            this.levelStartPos = spritePositionInfo.TRANSLATION;

            this.destructablesRemoved = new List<Block>();
            this.shadowsRemoved = new List<Rectangle>();
            this.keysTaken = new List<Block>();

            this.jump = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("jump");
            this.pickup = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("pickup");
            this.hurt = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("hurt");
            this.endGame = SpriteManager.GAME.SOUNDMANAGER.getEffectInstance("endGame");

            this.peakHeight = spritePositionInfo.TRANSLATIONY;

            this.walkingLine = new Line(0, POSITIONINFO.BOUNDS.Top, 0, POSITIONINFO.BOUNDS.Bottom);
            System.Diagnostics.Debug.WriteLine(walkingLine.start + " : " + walkingLine.end);
        }
Пример #10
0
        /*
         * 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;
        }