Example #1
0
        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");
        }
Example #2
0
        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");
        }