Beispiel #1
0
 public static void Init(GraphicsDevice gd)
 {
     StateSpriteGood = new FAFSprite("Content/InfluencerStateGood.png");
     StateSpriteBad  = new FAFSprite("Content/InfluencerStateBad.png");
     StateSpriteGood.LoadContent(gd);
     StateSpriteBad.LoadContent(gd);
 }
Beispiel #2
0
        public void LoadContent(GraphicsDevice gd)
        {
            spriteLeftMost = spriteRightMost = null;

            float width = 0;

            foreach (var sp in spriteBackground)
            {
                sp.LoadContent(gd);
                sp.Scale = new Vector2(viewPort.Height / sp.Size.Height);

                if (spriteRightMost == null)
                {
                    sp.Position    = new Vector2(viewPort.X, viewPort.Y);
                    spriteLeftMost = sp;
                }
                else
                {
                    sp.Position = new Vector2(spriteRightMost.Position.X + spriteRightMost.Size.Width, viewPort.Y);
                }

                spriteRightMost = sp;
                width          += sp.Size.Width;
            }

            int i = 0;

            // fill the viewport with sprites
            if (spriteBackground.Count > 0 && width < viewPort.Width * 2)
            {
                do
                {
                    var sp = new FAFSprite(spriteBackground[i].AssetName);
                    sp.LoadContent(gd);
                    sp.Scale    = new Vector2((float)viewPort.Height / (float)sp.Size.Height);
                    sp.Position = new Vector2(spriteRightMost.Position.X + spriteRightMost.Size.Width, viewPort.Y);
                    spriteBackground.Add(sp);
                    spriteRightMost = sp;

                    width += sp.Size.Width;

                    i++;
                    if (i > spriteBackground.Count - 1)
                    {
                        i = 0;
                    }
                } while (width < viewPort.Width * 2);
            }
        }
Beispiel #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // init scrolling background
            scrollingBackground = new FAFScrollingBackground(GraphicsDevice.Viewport);
            scrollingBackground.AddBackground("Content/Background01.png");
            scrollingBackground.AddBackground("Content/Background02.png");
            scrollingBackground.AddBackground("Content/Background03.png");
            scrollingBackground.AddBackground("Content/Background04.png");
            scrollingBackground.AddBackground("Content/Background05.png");
            scrollingBackground.AddBackground("Content/Background06.png");
            scrollingBackground.AddBackground("Content/Background07.png");
            scrollingBackground.AddBackground("Content/Background08.png");
            scrollingBackground.AddBackground("Content/Background09.png");
            scrollingBackground.AddBackground("Content/Background10.png");
            scrollingBackground.AddBackground("Content/Background11.png");
            scrollingBackground.LoadContent(GraphicsDevice);

            // init font
            fontCAFNormal  = Content.Load <SpriteFont>("CAFFont");
            fontCAFMassive = Content.Load <SpriteFont>("CAFFontMassive");

            // ui
            uiBackgroundGrey   = new Texture2D(GraphicsDevice, 1, 1);
            uiBackgroundShadow = new Texture2D(GraphicsDevice, 1, 1);
            uiBackgroundGrey.SetData(new[] { new Color(49, 49, 49) });
            uiBackgroundShadow.SetData(new[] { new Color(0f, 0f, 0f, 0.5f) });
            uiFingerGlyph = Content.Load <Texture2D>("MiddleFinger");
            uiBigBadBoss  = new FAFSprite("Content/BigBadBoss.png");
            uiBigBadBoss.LoadContent(GraphicsDevice);
            uiGameOverTitle = new FAFSprite("Content/GameOverTitle.png");
            uiGameOverTitle.LoadContent(GraphicsDevice);
            uiGameOverButton = new FAFSprite("Content/GameOverRestartButton.png");
            uiGameOverButton.LoadContent(GraphicsDevice);
            uiTitleHeader = new FAFSprite("Content/TitleHeader.png");
            uiTitleHeader.LoadContent(GraphicsDevice);
            uiTitleButton = new FAFSprite("Content/TitleButton.png");
            uiTitleButton.LoadContent(GraphicsDevice);

            // player
            animPlayerRunning     = FAFSpriteAnimation.FromFrameCount(250, 358, 12, frameRate: 0.06);
            animPlayerJumping     = FAFSpriteAnimation.FromFrameCount(250, 358, 1, 358); // one jump frame
            spritePlayer          = new FAFSprite("Content/CharacterPlayer.png", animPlayerRunning);
            playerStartY          = GraphicsDevice.Viewport.Height - 400;
            playerMinY            = -GraphicsDevice.Viewport.Height;
            spritePlayer.Position = new Vector2(50, playerStartY);
            spritePlayer.LoadContent(GraphicsDevice);

            // influencers
            FAFInfluencer.Init(GraphicsDevice);
            influencers.Add(InfluencerType.Kimble, new FAFInfluencer(new FAFSprite("Content/InfluencerKimble.png"), GraphicsDevice)
            {
                PointsOnCollision = -192,
                Speed             = 2,
                VariableYAmount   = 20
            });
            influencers.Add(InfluencerType.FixedPriceSales, new FAFInfluencer(new FAFSprite("Content/InfluencerSales.png"), GraphicsDevice)
            {
                PointsOnCollision = -192,
                Speed             = 1
            });
            influencers.Add(InfluencerType.Nandos, new FAFInfluencer(new FAFSprite("Content/InfluencerNandos.png"), GraphicsDevice)
            {
                PointsOnCollision = 192,
                VariableYAmount   = 3
            });
            influencers.Add(InfluencerType.ProjectLaunch, new FAFInfluencer(new FAFSprite("Content/InfluencerLaunch.png"), GraphicsDevice)
            {
                PointsOnCollision = 192,
                Speed             = 1
            });
            influencers.Add(InfluencerType.Whitfield, new FAFInfluencer(new FAFSprite("Content/InfluencerSteve.png"), GraphicsDevice)
            {
                PointsOnCollision = -192,
                Speed             = 3,
                VariableYAmount   = 5
            });
            influencers.Add(InfluencerType.SalaryIncrease, new FAFInfluencer(new FAFSprite("Content/InfluencerSalary.png"), GraphicsDevice)
            {
                PointsOnCollision = 192,
                Speed             = 1
            });

            RestartGame();
            playerGameState = GameState.Title;
        }
Beispiel #4
0
 public FAFInfluencer(FAFSprite sp, GraphicsDevice gd)
 {
     Sprite = sp;
     sp.LoadContent(gd);
 }