예제 #1
0
        public TreeController(Viewport vp, ContentManager content)
        {
            Trees = new List<Tree>();

            baseTreeTxtr = content.Load<Texture2D>(@"Tree/Base");
            sides[0] = content.Load<Texture2D>(@"Tree/LogLeft");
            sides[1] = content.Load<Texture2D>(@"Tree/LogRight");
            sides[2] = content.Load<Texture2D>(@"Tree/LogNEU");

            viewport = vp;
            float xSize = viewport.Width * 0.5f;
            size = new Vector2(xSize, xSize * 0.7407f);
            StandardX = Convert.ToInt32(viewport.Width / 2);

            DownRate = size.Y;
            float sizeX = viewport.Width * 0.25f;

            Vector2 baseSize = new Vector2(sizeX, sizeX * 0.1125f);
            Vector2 baseLocation = new Vector2(StandardX, viewport.Height - (baseSize.Y * 7));
            Tree baseLog = new Tree(baseLocation, baseSize, baseTreeTxtr);

            locations[0] = xSize / 4;
            locations[1] = StandardX - (xSize / 4);
            Trees.Add(baseLog);

            for (int i = 1; i < 12; i++)
            {
                Tree prevT = Trees[i - 1];
                Tree t = new Tree(new Vector2(locations[i % 2], prevT.location.Y - size.Y), size, sides[i % 2]);
                Trees.Add(t);
            }
        }
예제 #2
0
파일: Game1.cs 프로젝트: jayhxmo/lumberjack
 public void resetGame()
 {
     if (Tree.genNewTree)
         Tree = new Tree(this.Content, displayPort);
     MainPlayer.score.score = 0;
     playerHealth.life = 50;
     Screen.goToScreen("");
     inGame = true;
     isPaused = false;
 }
예제 #3
0
파일: Game1.cs 프로젝트: jayhxmo/lumberjack
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            viewport = GraphicsDevice.Viewport;
            displayPort = viewport;
            displayPort.Width -= 320;
            displayPort.X = 160;

            MainPlayer = new Player(displayPort, viewport);
            Tree = new Tree(this.Content, displayPort);

            playerHealth = new Health(viewport, this.Content);

            this.IsMouseVisible = true;

            base.Initialize();
        }
예제 #4
0
        public void Update()
        {
            for (int i = 1; i < Trees.Count; i++)
            {
                Trees[i].Update(DownRate);
            }

            Trees.RemoveAt(1);
            Tree prevT = Trees[Trees.Count - 1];
            Tree t = new Tree(new Vector2(locations[0], prevT.location.Y - size.Y), size, sides[0]);
            Trees.Add(t);
        }
예제 #5
0
파일: Main.cs 프로젝트: jayhxmo/lumberjack
        protected override void Initialize()
        {
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            viewport = GraphicsDevice.Viewport;

            int width = viewport.Width;
            int height = viewport.Height;

            if (width > height)
            {
                int temp = width;
                width = height;
                height = temp;
            }

            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth = width;

            graphics.SupportedOrientations = DisplayOrientation.Portrait;

            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            viewport = GraphicsDevice.Viewport;

            MainPlayer = new Player(viewport);
            Tree = new Tree(this.Content);

            playerHealth = new Health(viewport, this.Content);

            AdGameComponent.Initialize(this, appID);
            Components.Add(AdGameComponent.Current);

            // Create an actual ad for display.
            CreateAd();

            base.Initialize();
        }