예제 #1
0
 public MovingPath(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float velObj,
     Vector2 point1,Vector2 point2, bool isDeath)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
     this.velObj = velObj;
     //if (game.gMode == 0)
         //body.LinearVelocity = new Vector2(shootAngle.X * velObj, shootAngle.Y * velObj);
     this.isDeath = isDeath;
     this.point1 = point1;
     this.point2 = point2;
     double angel = Math.Atan2((double)(point2.Y - point1.Y), (double)(point2.X - point1.X)) * 180/Math.PI;
     float x = (float)Math.Cos(angel*Math.PI/180f);
     //if (x < 0.000000000001f)
         //x = 0;
     float y = (float)Math.Sin(angel*Math.PI/180f);
     //if (y < 0.000000000001f)
         //y = 0;
     ///this.path = point1 - point2;// new Vector2(x * 2, -y * 2);
     this.path = new Vector2(x, y);
     this.validPoint = ConvertUnits.ToSimUnits(point1);
     //body.ApplyLinearImpulse(path);
     goalPoint = ConvertUnits.ToSimUnits(point2);
 }
예제 #2
0
 public CutSceneMovingItem(Game g, Arena a, float xPos, float yPos, float xPosEnd,float yPosEnd,int playerNum, String spriteNumber, float startTime, float endTime)
     : base(g,a,xPos,yPos,playerNum,spriteNumber,startTime,endTime)
 {
     this.xPosEnd = game.drawingTool.ActualScreenPixelWidth*xPosEnd;
     this.yPosEnd = game.drawingTool.ActualScreenPixelHeight * yPosEnd;
     this.xPosStart = game.drawingTool.ActualScreenPixelWidth * xPos;
     this.yPosStart = yPos;
 }
예제 #3
0
 public CutSceneMovingItem(Game g, Arena a, float xPos, float yPos, float xPosEnd, float yPosEnd, int playerNum, String spriteNumber, float aValue, bool loadFromCT)
     : base(g,a,xPos,yPos,playerNum,spriteNumber,aValue,loadFromCT)
 {
     this.xPosEnd = game.drawingTool.ActualScreenPixelWidth * xPosEnd;
     this.yPosEnd = game.drawingTool.ActualScreenPixelHeight * yPosEnd;
     this.xPosStart = game.drawingTool.ActualScreenPixelWidth * xPos;
     this.yPosStart = game.drawingTool.ActualScreenPixelHeight * yPos;
 }
예제 #4
0
 public CutSceneText(Game g, Arena a, Vector2 points, int playerNum, String[] text, float orderNumber)
     : base(g, a, points.X, points.Y, playerNum, "Error", -1, false)
 {
     xi = (XboxInput)game.playerOneInput;
     this.IsVisible = true;
     this.text = text;
     this.orderNumber = orderNumber;
     this.keyInput = new KeyboardInput();
 }
예제 #5
0
 public CutSceneMultipleMoves(Game g, Arena a, Vector2[] points, int playerNum, String spriteNumber, bool loadFromCT)
     : base(g, a, points[0].X, points[0].Y, playerNum, spriteNumber, -1, loadFromCT)
 {
     xi = (XboxInput)game.playerOneInput;
     this.points = points;
     goalPoint = new Vector2(points[0].X * game.drawingTool.ActualScreenPixelWidth,
         points[0].Y * game.drawingTool.ActualScreenPixelHeight);
     this.IsVisible = true;
 }
예제 #6
0
 public BackgroundBlock(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float height, float width)
     : base(g,a,pos,playerNum,spriteNumber,height,width,1,0)
 {
     this.spriteName = spriteNumber;
     this.height = height;
     this.width = width;
     this.startPos = pos;
     this.pos = pos+Constants.player1SpawnLocation;
     this.blockSprite = game.getSprite(spriteNumber);
 }
예제 #7
0
 public GoalBlock(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber,int nextLevel)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(playerSprite.index.Width / 2, playerSprite.index.Height / 2);
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
     this.nextLevel = nextLevel;
 }
예제 #8
0
 public DeathBlock(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float rotation)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     this.rotationAngle = rotation;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
 }
예제 #9
0
 public MovingDeath(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber,Vector2 shootAngle,float velObj)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
     this.shootAngle = shootAngle;
     this.velObj = velObj;
     if(game.gMode==0)
         body.LinearVelocity = new Vector2(shootAngle.X, shootAngle.Y);
 }
예제 #10
0
파일: Missle.cs 프로젝트: emre801/GameGame
 public Missle(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float velObj,
     bool isDeath)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
     this.velObj = velObj;
     this.isDeath = isDeath;
     body.Awake = true;
 }
예제 #11
0
 public LayerBlock(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float height, float width,float rotation,int ownerBlock)
     : base(g, a, pos, playerNum, spriteNumber, height, width, 1, 0)
 {
     this.pos = Constants.player1SpawnLocation;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     this.rotationAngle = rotation;
     this.width = width;
     this.height = height;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(width / 2, height / 2);
     this.owner = ownerBlock;
     this.drawLevel = 100;
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
 }
예제 #12
0
 public SignBlock(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float rotation, float width, float height)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     this.rotationAngle = rotation;
     this.width = width;
     this.height = height;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
     //fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
     //fixture.OnSeparation += new OnSeparationEventHandler(OnSeparation);
     this.keyInput = new KeyboardInput();
 }
예제 #13
0
 public CutSceneItem(Game g, Arena a,float xPos,float yPos, int playerNum, String spriteNumber,float startTime,float endTime)
     : base(g)
 {
     this.pos = new Vector2(game.drawingTool.ActualScreenPixelWidth*xPos,game.drawingTool.ActualScreenPixelHeight*yPos);
     this.origPos = new Vector2(game.drawingTool.ActualScreenPixelWidth * xPos, game.drawingTool.ActualScreenPixelHeight * yPos);
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     //this.height = height;
     //this.width = width;
     this.blockNumber = game.blockNumber;
     this.startTime = startTime;
     this.endTime = endTime;
     this.IsVisible = false;
     game.blockNumber++;
     LoadContent();
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
 }
예제 #14
0
        public MagnetBlock(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, Vector2 magnetPulse, float height, float width, bool isFan)
            : base(g)
        {
            this.pos = Constants.player1SpawnLocation + pos;
            this.origPos = pos;
            this.drawPriority = Constants.PLAYER_DRAWPRI;
            this.spriteNumber = spriteNumber;
            this.width = width;
            this.height = height;
            LoadContent();
            SetUpPhysics(Constants.player1SpawnLocation + pos);
            origin = new Vector2(playerSprite.index.Width / 2, playerSprite.index.Height / 2);
            fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
            fixture.OnSeparation += new OnSeparationEventHandler(OnSeparation);

            this.magnetPulse = magnetPulse;
            this.isFan = isFan;
        }
예제 #15
0
 public MovingCycle(Game g, Arena a, Vector2 pos, int playerNum, String spriteNumber, float velObj,
     List<Vector2> pathPoints, bool isDeath)
     : base(g)
 {
     this.pos = Constants.player1SpawnLocation + pos;
     this.origPos = pos;
     this.drawPriority = Constants.PLAYER_DRAWPRI;
     this.spriteNumber = spriteNumber;
     LoadContent();
     SetUpPhysics(Constants.player1SpawnLocation + pos);
     origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
     fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
     this.velObj = velObj;
     this.isDeath = isDeath;
     this.pathPoints = pathPoints;
     goalPoint = ConvertUnits.ToSimUnits((Vector2)pathPoints[pathCounter]);
     body.Awake = true;
 }
예제 #16
0
        public PlayableCharacter(Game g, Arena a, Vector2 pos, int playerNum)
            : base(g)
        {
            this.pos = pos;
            this.drawPriority = Constants.PLAYER_DRAWPRI;
            LoadContent();
            SetUpPhysics(pos);
            fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
            fixture.OnSeparation += new OnSeparationEventHandler(OnSeparation);

            //this.origin = new Vector2(playerSprite.index.Width / 2, playerSprite.index.Height / 2);
            this.origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
            modes = Modes.AIRDOWN;
            shiftPosition = new Vector2(0, 0);
            yOld = body.Position.X;
            run = false;
            if (g.isInCreatorMode)
                body.IgnoreGravity = true;
            keyInput = new KeyboardInput();
        }
예제 #17
0
 public MouseItem(Game g, Arena a, Vector2 pos, int playerNum)
     : base(g)
 {
     MouseState mouseState = Mouse.GetState();
     mousePosition = new Vector2(mouseState.X, mouseState.Y);
 }
예제 #18
0
파일: Block.cs 프로젝트: emre801/GameGame
        public Block(Game g, Arena a, Vector2 pos, int playerNum,String spriteNumber,float height, float width,int drawLevel, float rotation)
            : base(g)
        {
            this.pos = Constants.player1SpawnLocation + pos;
            this.origPos = pos;
            this.drawPriority = Constants.PLAYER_DRAWPRI;
            this.spriteNumber = spriteNumber;
            this.height = height;
            this.width = width;
            this.blockNumber = game.blockNumber;
            game.blockNumber++;
            this.drawLevel = drawLevel;
            this.rotationAngle = rotation;
            this.associatedLevel = game.currentLevel;
            SetUpPhysics(Constants.player1SpawnLocation + pos);
            LoadContent();
            origin = new Vector2(ani.widthOf() / 2, ani.heightOf() / 2);
            fixture.OnCollision += new OnCollisionEventHandler(OnCollision);
            if (!game.backToTitleScreen)
            {

                if (spriteNumber.Equals("bigBlock"))
                {
                    //This is a test... still working on fixing it.

                    /*
                    float widthOfObject = game.getSprite("grassTemplate").index.Width;
                    float heighOfObject = game.getSprite("grassTemplate").index.Width;
                    float XX = XX = pos.X - width / 2;
                    for (XX = pos.X - width / 2; XX < pos.X + width / 2; XX += widthOfObject)
                    {
                        if (XX + widthOfObject < pos.X + width/2)
                        {
                            LayerBlock lb = new LayerBlock(game, a, new Vector2(XX + widthOfObject / 2, pos.Y - height / 2), 1, "grassTemplate", game.getSprite("grassTemplate").index.Height, game.getSprite("grassTemplate").index.Width, 0, blockNumber);
                            game.addEntity(lb);
                        }
                    }

                    if (XX + widthOfObject > pos.X + width / 2)
                    {
                        float endLength = (XX + widthOfObject) - (pos.X + width / 2f);
                        //LayerBlock lb = new LayerBlock(game, a, new Vector2(XX - endLength/2, pos.Y - height / 2), 1, "grassTemplate", game.getSprite("grassTemplate").index.Height, endLength, 0, blockNumber);
                        //game.addEntity(lb);

                    }
                     * */
                    /*
                    float widthOfObject = game.getSprite("groundWall").index.Width;
                    float heighOfObject = game.getSprite("groundWall").index.Width;
                    float XX = XX = pos.X - width / 2;
                    for (XX = pos.X - width / 2; XX < pos.X + width / 2; XX += widthOfObject)
                    {
                        if (XX + widthOfObject < pos.X + width / 2)
                        {
                            LayerBlock lb = new LayerBlock(game, a, new Vector2(XX + widthOfObject / 2, pos.Y + height / 2), 1, "groundWall", game.getSprite("groundWall").index.Height, game.getSprite("groundWall").index.Width, 90, blockNumber);
                            game.addEntity(lb);
                        }
                    }

                    if (XX + widthOfObject > pos.X + width / 2)
                    {
                        float endLength = (XX + widthOfObject) - (pos.X + width / 2f);
                        //LayerBlock lb = new LayerBlock(game, a, new Vector2(XX - endLength/2, pos.Y - height / 2), 1, "grassTemplate", game.getSprite("grassTemplate").index.Height, endLength, 0, blockNumber);
                        //game.addEntity(lb);

                    }
                     * */

                }
            }
        }