예제 #1
0
파일: Banana.cs 프로젝트: Loktor/MonkeyJump
 public override void Init(Rectangle gameBounds)
 {
     base.Init(gameBounds);
     gameManager = GameManager.Instance;
     position.Y = -bananaSize.Height;
     Collider = BananaCollider(position, bananaSize, false,Direction);
 }
예제 #2
0
        public void Init(Rectangle gameBounds, Vector2 pos)
        {
            base.Init(gameBounds);
            gameManager = GameManager.Instance;

            bananas = new List<Banana>();

            for(int i = 0; i<3; i++)
            {
                Banana b = new Banana(bananaSize,Direction.Left);

                b.texture = gameManager.ResourceManager.RetreiveTexture(ResourceManager.BANANA_SCORE_PATH);
                b.Init(gameManager.GameBounds);

                b.Origin = new Vector2(bananaSize.Width/2, bananaSize.Height/2);

                b.position = pos;
                b.position.X += r.Next(30)-15;
                b.position.Y += r.Next(30)-15;

                b.Rotation = (float)r.NextDouble() * 3;

                b.SpriteEffects = r.Next(2) == 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;

                bananas.Add(b);
            }
        }
예제 #3
0
 public override void Init(Rectangle gameBounds)
 {
     base.Init(gameBounds);
     gameManager = GameManager.Instance;
     position.X = new Random(DateTime.Now.Millisecond).Next(gameBounds.Width - 128) + gameBounds.X + 64;
     position.Y = -coconutSize.Height;
     Collider = new Collider(position, coconutSize, false);
 }
예제 #4
0
파일: Shark.cs 프로젝트: Loktor/MonkeyJump
 public override void Init(Rectangle gameBounds)
 {
     base.Init(gameBounds);
     gameManager = GameManager.Instance;
     this.gameBounds = gameBounds;
     position.X = 0-sharkSize.Width;
     position.Y = sharkYPos;
     texture = gameManager.ResourceManager.RetreiveTexture(ResourceManager.SHARK_PATH);
     headingDirection = Direction.Right;
 }
예제 #5
0
파일: Leaf.cs 프로젝트: Loktor/MonkeyJump
        public override void Init(Rectangle gameBounds)
        {
            base.Init(gameBounds);
            gameManager = GameManager.Instance;

            Direction = new Random().Next(2) == 0 ? Direction.Left : Direction.Right;
            SpriteEffects = Direction == Direction.Left ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            position.X = Direction == Direction.Left ? gameBounds.X / 2 : gameBounds.Right + gameBounds.X / 2 - leafSize.Width;
            position.Y = -(leafSize.Height +70);
            Collider = LeafCollider(position, leafSize, false, Direction);
        }
예제 #6
0
 public static GameManager CreateNewGameManager(Viewport screen)
 {
     instance = new GameManager(screen);
     return instance;
 }
예제 #7
0
파일: Player.cs 프로젝트: Loktor/MonkeyJump
 public override void Init(Rectangle gameBounds)
 {
     base.Init(gameBounds);
     gameManager = GameManager.Instance;
     position.X = gameBounds.X;
     position.Y = monkeyYLevel;
     headingDirection = Direction.Left;
     playerState = PlayerState.Climbing;
     //collider = new Collider(position, monkeySize,true);
     climbCollider = CreateClimbCollider(position, monkeySize, true,headingDirection);
     jumpCollider = CreateJumpCollider(position,monkeySize, true,headingDirection);
     Collider = climbCollider;
     this.gameBounds = gameBounds;
     gameYCenter = (gameBounds.Width / 2) + gameBounds.X;
 }
예제 #8
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            if (gameManager == null)
                gameManager = GameManager.CreateNewGameManager(ScreenManager.GraphicsDevice.Viewport);

            gameFont = content.Load<SpriteFont>("gamefont");

            gameManager.GameOver += new GameOverEventHandler(HandleGameOver);
            gameManager.LoadEntityTextures(content);

            gameManager.InitEntities();

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            //Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();

            if (SaveGameManager.Instance.Options.BackgroundMusicEnabled)
            {
                bgMusic = content.Load<Song>("game/bgSound");
                MediaPlayer.IsRepeating = true;

                MediaPlayer.Play(bgMusic);
            }
        }