public void addAnimatedSpriteStrip(AnimatedSpriteStrip thisAnim) { if (actionsAddedCount > myAnimatedSpriteStrips.Length) { Console.WriteLine("adding too many actions for your actions manager"); } else { myAnimatedSpriteStrips[actionsAddedCount] = thisAnim; actionsAddedCount = actionsAddedCount + 1; } }
public AnimatedSpriteStripManager LoadSprites() { AnimatedSpriteStripManager player_manager = new AnimatedSpriteStripManager(7); // Player Idle player.texture = Content.Load <Texture2D>("SpriteSheet/idle"); AnimatedSpriteStrip idle_strip = new AnimatedSpriteStrip(player.texture, 0.05f, true); idle_strip.setName("idle"); player_manager.addAnimatedSpriteStrip(idle_strip); // Player Running player.texture = Content.Load <Texture2D>("SpriteSheet/run"); AnimatedSpriteStrip run_strip = new AnimatedSpriteStrip(player.texture, 0.05f, true); run_strip.setName("run"); player_manager.addAnimatedSpriteStrip(run_strip); // Player Jump player.texture = Content.Load <Texture2D>("SpriteSheet/jump"); AnimatedSpriteStrip jump_strip = new AnimatedSpriteStrip(player.texture, 0.1f, true); jump_strip.setName("jump"); player_manager.addAnimatedSpriteStrip(jump_strip); // Player Shoot player.texture = Content.Load <Texture2D>("SpriteSheet/shoot"); AnimatedSpriteStrip shoot_strip = new AnimatedSpriteStrip(player.texture, 0.2f, false); shoot_strip.setName("shoot"); player_manager.addAnimatedSpriteStrip(shoot_strip); // Player Run + Shoot player.texture = Content.Load <Texture2D>("SpriteSheet/run+shoot"); AnimatedSpriteStrip run_shoot_strip = new AnimatedSpriteStrip(player.texture, 0.05f, true); run_shoot_strip.setName("run+shoot"); player_manager.addAnimatedSpriteStrip(run_shoot_strip); // Player Slide player.texture = Content.Load <Texture2D>("SpriteSheet/slide"); AnimatedSpriteStrip slide_strip = new AnimatedSpriteStrip(player.texture, 0.05f, true); slide_strip.setName("slide"); player_manager.addAnimatedSpriteStrip(slide_strip); return(player_manager); }
public void LoadEnemy(ContentManager content) { AnimatedSpriteStrip enemyRunning = new AnimatedSpriteStrip(content.Load <Texture2D>("NinjaRun"), 10, 0.1f, true); AnimatedSpriteStrip enemyIdle = new AnimatedSpriteStrip(content.Load <Texture2D>("NinjaIdle"), 10, 0.1f, true); AnimatedSpriteStrip enemyAttack = new AnimatedSpriteStrip(content.Load <Texture2D>("NinjaAttack"), 9, 0.1f, true); enemyRunning.setName("run"); enemyIdle.setName("idle"); enemyAttack.setName("attack"); enemy.addAnimatedSpriteStrip(enemyRunning); enemy.addAnimatedSpriteStrip(enemyIdle); enemy.addAnimatedSpriteStrip(enemyAttack); enemy.XPos = 4500; enemy.YPos = 420; xVelocity = 3; eHealth = 100; }
public void LoadKnight(ContentManager Content) { AnimatedSpriteStrip myKnightRunning = new AnimatedSpriteStrip(Content.Load <Texture2D>("KnightRun"), 10, 0.1f, true); AnimatedSpriteStrip myKnightJumping = new AnimatedSpriteStrip(Content.Load <Texture2D>("KnightJump"), 10, 0.1f, true); AnimatedSpriteStrip myKnightIdle = new AnimatedSpriteStrip(Content.Load <Texture2D>("KnightIdle"), 10, 0.1f, true); AnimatedSpriteStrip myKnightAttack = new AnimatedSpriteStrip(Content.Load <Texture2D>("KnightAttack"), 9, 0.1f, true); myKnightRunning.setName("run"); myKnightJumping.setName("jump"); myKnightIdle.setName("idle"); myKnightAttack.setName("attack"); myKnight.addAnimatedSpriteStrip(myKnightRunning); myKnight.addAnimatedSpriteStrip(myKnightJumping); myKnight.addAnimatedSpriteStrip(myKnightIdle); myKnight.addAnimatedSpriteStrip(myKnightAttack); myKnight.XPos = 200; myKnight.YPos = 200; //knightPos.Y = myKnight.YPos; //knightPos.X = myKnight.XPos; startY = myKnight.YPos; jumpspeed = 0; is_grounded = true; }