Exemple #1
1
        /// <summary>
        /// Create a new game screen. Should be done every time there is a new game.
        /// </summary>
        /// <param name="theScreenEvent"></param>
        /// <param name="contentManager"></param>
        public GameScreen(EventHandler theScreenEvent,ContentManager contentManager)
            : base(theScreenEvent)
        {
            bScoreWasAdded = false;

            this.contentManager = contentManager;
            dlDoubleJumpTimer = new DanLabel(1150, 20, 100, 50);

            //Init our intrepid hero
            csHero = new ControlledSprite();

            bg = new LayeredBackground();

            djeJumpEffect = new DoubleJumpEffect();

            altimeter = new Altimeter(); // Make a camera for the screen with an altimeter
            cCamera = new Camera(50, 100, 600, 520, altimeter);

            blocks = new List<Sprite>();
            Sprite sp = new Sprite();
            blocks.Add(sp);
            sp = new Sprite();
            blocks.Add(sp);
            sp = new Sprite();
            blocks.Add(sp);
            sp = new Sprite();
            blocks.Add(sp);
            sp = new Sprite();
            blocks.Add(sp);

            // REVIST Set up the Arcing Block Manager with the difficulty
            arcingBlockManager = new ArcingBlockManager(cCamera, blocks, contentManager, 500, 300, 150, "Sprites/block2");
        }
        /// <summary>
        /// Create a new Arcing Block generator
        /// </summary>
        /// <param name="camera">The camera for the game.</param>
        /// <param name="blocks">The primary list of blocks.</param>
        /// <param name="contentManager">The Content Manager.</param>
        /// <param name="rate">The rate at which blocks spawn.</param>
        /// <param name="variance">The randomness of the speed of which blocks spawn.</param>
        /// <param name="gravity">The gravity applied to the blocks.</param>
        /// <param name="picName">The image used for the blocks.</param>
        public ArcingBlockManager(Camera camera, List<Sprite> blocks, ContentManager contentManager, int rate, int variance, int gravity, String picName )
        {
            IsSpawning = true;

            this.camera=camera;
            this.rate = rate;
            this.variance = variance;
            this.gravity = gravity;
            this.blocks = blocks;
            this.contentManager=contentManager;
            this.picName=picName;
            rand = new Random();
            lastAdd = -rate;
            nextVariance = 0;
        }