public FAFSprite(string assetName, FAFSpriteAnimation animation = null) { Position = Vector2.Zero; AssetName = assetName; Scale = new Vector2(1f); Animation = animation; }
/// <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; }