示例#1
0
        public GameScreen(IGame game)
            : base(game)
        {
            // Initialize game objects here

            bg1 = new Background(0, 0);
            bg2 = new Background(2160, 0);
            robot = new Robot();
            hb = new Heliboy(340, 360);
            hb2 = new Heliboy(700, 360);

            character = Assets.character;
            character2 = Assets.character2;
            character3 = Assets.character3;

            heliboy = Assets.heliboy;
            heliboy2 = Assets.heliboy2;
            heliboy3 = Assets.heliboy3;
            heliboy4 = Assets.heliboy4;
            heliboy5 = Assets.heliboy5;

            anim = new Animation();
            anim.addFrame(character, 1250);
            anim.addFrame(character2, 50);
            anim.addFrame(character3, 50);
            anim.addFrame(character2, 50);

            hanim = new Animation();
            hanim.addFrame(heliboy, 100);
            hanim.addFrame(heliboy2, 100);
            hanim.addFrame(heliboy3, 100);
            hanim.addFrame(heliboy4, 100);
            hanim.addFrame(heliboy5, 100);
            hanim.addFrame(heliboy4, 100);
            hanim.addFrame(heliboy3, 100);
            hanim.addFrame(heliboy2, 100);

            currentSprite = anim.getImage();

            loadMap();

            // Defining a paint object
            paint1 = new Paint();
            paint1.SetTextSize(30);
            paint1.SetTextAlign(Paint.Align.CENTER);
            paint1.SetAntiAlias(true);
            paint1.SetColor(Color.WHITE);

            paint2 = new Paint();
            paint2.SetTextSize(100);
            paint2.SetTextAlign(Paint.Align.CENTER);
            paint2.SetAntiAlias(true);
            paint2.SetColor(Color.WHITE);

        }
示例#2
0
        private void nullify()
        {

            // Set all variables to null. You will be recreating them in the
            // constructor.
            paint1 = null;
            bg1 = null;
            bg2 = null;
            robot = null;
            hb = null;
            hb2 = null;
            currentSprite = null;
            character = null;
            character2 = null;
            character3 = null;
            heliboy = null;
            heliboy2 = null;
            heliboy3 = null;
            heliboy4 = null;
            heliboy5 = null;
            anim = null;
            hanim = null;

            // Call garbage collector to clean up memory.
            Java.Lang.System.Gc();

        }
示例#3
0
 public void setBg(Background bg)
 {
     this.bg = bg;
 }