コード例 #1
0
ファイル: pong.cs プロジェクト: SeaHarg/Snake
        public override void gameIni()
        {
            //set screen size
            this.setScreenSize(400, 400);
            //set screen colour
            this.setScreenColour(Microsoft.Xna.Framework.Graphics.Color.Black);
            //there should be no gravity
            this.setGravity(0);

            //create ball sprite
            ball = new sprite(this, "pong",  10, 10, 240, 120);
            leftPaddle = new sprite(this, "pong",  10, 80, 10, 160);
            rightPaddle = new sprite(this, "pong", 10, 80, 380, 160);
            //disable physics collisions
            //otherwise physics engine takes control of paddles response to being hit
            leftPaddle.enableCollision(false);
            rightPaddle.enableCollision(false);
            ball.enableCollision(false);

            //text objects to be used in the game
            title = new text(this, "pongText", "PONG");
            playerScore = new text(this, "pongText", "0");
            computerScore = new text(this, "pongText", "0");

            //sets ball initial velocity
            ball.setVelocity(150, 150);
        }
コード例 #2
0
ファイル: exampleGame.cs プロジェクト: SeaHarg/Snake
        public override void gameIni()
        {
            ball = new spriteCircle(this,"ball","ball1" ,50, 50, 25, 25);
            ball2 = new spriteCircle(this, "ball","ball2", 20, 20, 200, 200);
            sprites.Add(ball);
            sprites.Add(ball2);
            s1 = new sound(this, "ring");
            //this.ps.Gravity = new FarseerGames.FarseerPhysics.Mathematics.Vector2 (0f,9.84f);//PHYSICS
            t1 = new text(this, "testFont", "This is a test");

            this.ps.Gravity = new FarseerGames.FarseerPhysics.Mathematics.Vector2(0f, 9.81f);
        }
コード例 #3
0
ファイル: netBeachVolleyball.cs プロジェクト: SeaHarg/Snake
        public override void gameIni()
        {
            //set the size of the screen
            //this.setScreenSize(400, 400);
            //create the floor (use an image of sand)
            sand = new sprite(this,  "sand", 400, 100, 200, 450);
            //don't let the floor move
            sand.makeStatic(true);

            //create the left wall and don't let it move
            wallLeft = new sprite(this,  "sand", 5, 400, 2, 200);
            wallLeft.makeStatic(true);

            //create the right wall and on't let it move
            wallRight = new sprite(this, "bottomPost",  5, 400, 398, 200);
            wallRight.makeStatic(true);

            //create the left shell and don't allow it to be rotated
            leftShell = new sprite(this, "shell",  50, 50, 60, 310);
            leftShell.allowRotation(false);

            //create the right shell and don't allow it to be rotated
            rightShell = new sprite(this, "shell2", 50, 50, 340, 310);
            rightShell.allowRotation(false);

            //create the ball
            ball = new sprite(this,  "volleyball", 40, 40, 60, 190);
            //give it a mass that is less than the shells (by default all sprites are given a mass of 1)
            ball.setMass(0.1f);
            //set the balls bounciness (ranges from 0 -no bounve to 1-perfect bounce)
            ball.setBounciness(1);

            //create the post and make it immovable
            bottomPost = new sprite(this, "bottomPost", 10, 200, 200, 350);
            bottomPost.makeStatic(true);

            //set the gravity-tis value affects the speed at which objects are pulled to the ground
            this.setGravity(190.81f);

            //create text objects
            state = new text(this, "testFont", "Beach Volleyball");
            state1 = new text(this, "testFont", "Beach Volleyball");
            netState = new text(this, "testFont", "Beach Volleyball");
            leftScore = new text(this, "testFont", "0");
            rightScore = new text(this, "testFont", "0");
        }
コード例 #4
0
ファイル: racer.cs プロジェクト: SeaHarg/Snake
        public override void gameIni()
        {
            gameOver = false;
             finalStatus = new text(this, "Arial", "");
             //create random variable objects
             rX = new Random();
             rY = new Random();
             this.setScreenSize(300, 400);
             //there should be no gravity
             this.setGravity(0);

             road = new sprite(this,  "road", 300f, 400f, 150f, 200f);
             road.enableCollision(false);

             flag = new sprite(this,  "flag", 40, 40, 200, -1000);
             flag.enableCollision(false);

             line1 = new sprite(this,  "line", 10, 80, 145, 40);
             line1.enableCollision(false);
             line2 = new sprite(this,  "line", 10, 80, 145, 140);
             line2.enableCollision(false);
             line3 = new sprite(this,  "line", 10, 80, 145, 240);
             line3.enableCollision(false);
             line4 = new sprite(this,  "line", 10, 80, 145, 340);
             line4.enableCollision(false);

             car = new sprite(this, "car", 30f, 60f, 135f, 200f, FarseerGames.FarseerPhysics.CollisionCategory.Cat3, FarseerGames.FarseerPhysics.CollisionCategory.Cat1);
             //car.enableCollision(false);

             //kids

             kid1 = new sprite(this,  "kid2", 30, 30, rX.Next (100,200), rY.Next(20,100),FarseerGames.FarseerPhysics.CollisionCategory.Cat1 ,FarseerGames.FarseerPhysics.CollisionCategory.Cat3 );
             kid2 = new sprite(this,  "kid3", 30, 30, rX.Next(100, 200), rY.Next(20, 100),FarseerGames.FarseerPhysics.CollisionCategory.Cat2 ,FarseerGames.FarseerPhysics.CollisionCategory.Cat4 );

             //create text object for timer
             timer = new text(this, "Arial", "0 seconds");
        }
コード例 #5
0
ファイル: myPong.cs プロジェクト: SeaHarg/Snake
 public override void gameIni()
 {
     base.gameIni();
     test = new text(this, "pongText", theText);
 }
コード例 #6
0
ファイル: theGame.cs プロジェクト: SeaHarg/Snake
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            base.Initialize();
            white = Color.White;
            //*******create and build XACT engine files in the project Content\Audio folder (you'll need to make this folder)
            //rename the .xgs file to sounds.xgs
            //make sure the audio and sound bank files have the default names
            //using the XACT engine means you don't need to add sounds to content pipeline

            engine = new AudioEngine("..\\..\\..\\Content\\Audio\\win\\sounds.xgs");
            soundBank = new SoundBank(engine, "..\\..\\..\\Content\\Audio\\win\\Sound Bank.xsb");
            waveBank = new WaveBank(engine, "..\\..\\..\\Content\\Audio\\win\\Wave Bank.xwb");
            net=  new networker();
            test = new text(this, "pongText", theText);
        }
コード例 #7
0
ファイル: exampleGame.cs プロジェクト: SeaHarg/Snake
 public override void gameRender()
 {
     //screen.Draw(ball.asset , ball.position, white);
     ball.draw();
     ball2.draw();
     t1.draw(20, 20, Microsoft.Xna.Framework.Graphics.Color.Red);
     t1 = new text(this, "testFont", net.Message);
 }
コード例 #8
0
 public override void gameIni()
 {
     base.gameIni();
     test = new text(this, "pongText", theText);
 }