public void Initialize(Animation animation, Vector2 position) { this.Animation = animation; this.Position = position; Active = true; }
public void Initialize(Animation animation, Vector2 position, Direction direction, float velocity, int damage) { this.Direction = direction; this.Velocity = velocity; this.Damage = damage; base.Initialize(animation, position); }
public void Initialize(Animation animation, Vector2 position, Animation bulletAnimation, SoundEffect bulletSound) { this.bulletAnimation = bulletAnimation; this.bulletSound = bulletSound; Health = 3; Score = 0; MoveSpeed = 8.0f; lastShootTime = 0; ShootDelay = 500; bulletDamage = 1; base.Initialize(animation, position); }
public void Initialize(Animation animation, Vector2 position, Direction direction, int scoreValue, int squadPositionX, int squadPositionY) { this.Direction = direction; Damage = 1; Health = 1; //this.MoveSpeed = moveSpeed; this.ScoreValue = scoreValue; this.SquadPositionX = squadPositionX; this.SquadPositionY = squadPositionY; IsCrossedBottom = false; base.Initialize(animation, position); }
public void Initialize(List<Invader> invaders, Animation[] animations, List<Bullet> bullets, Animation bulletAnimation, SoundEffect bulletSound) { this.Invaders = invaders; this.Animations = animations; this.Bullets = bullets; this.BulletAnimation = bulletAnimation; this.BulletSound = bulletSound; SpaceBetween = new Vector2(10, 10); InvaderSize.X = animations[0].Width; InvaderSize.Y = animations[0].Height; for (int i = 1; i < animations.Length; i++) { if (InvaderSize.X < animations[i].Width) InvaderSize.X = animations[i].Width; if (InvaderSize.Y < animations[i].Height) InvaderSize.Y = animations[i].Height; } }
/// <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); // Load font spriteFont = Content.Load<SpriteFont>("font"); // Load player content Texture2D playerTexture = Content.Load<Texture2D>("player"); Animation playerAnimation = new Animation(); playerAnimation.Initialize(playerTexture, Vector2.Zero, 44, 30, 1f); Texture2D bulletTexture = Content.Load<Texture2D>("bullet"); Animation playerBullet = new Animation(); playerBullet.Initialize(bulletTexture, Vector2.Zero, 5, 8, 1f); SoundEffect playerBulletSound = Content.Load<SoundEffect>("sound\\bullet"); player.Initialize(playerAnimation, Vector2.Zero, playerBullet, playerBulletSound); // Load invaders animations Animation[] invadersAnimations = new Animation[InvadersSquad.SquadHeight]; for (int i = 0; i < InvadersSquad.SquadHeight; i++) { invadersAnimations[i] = new Animation(); invadersAnimations[i].Initialize( Content.Load<Texture2D>("invader" + i), Vector2.Zero, 30, 30, 1f); } invadersSquad.Initialize(invaders, invadersAnimations, invadersBullets, playerBullet, playerBulletSound); UI.Initialize(spriteFont, playerTexture); }