/* Constructor, wordt aangeroepen om een nieuw object(instantie van de class) te maken */ public AnimatedSprite(ContentManager content, int x, int y, Keys leftKey, Keys rightKey, Enemy enemy, EvilBabies game) { this.texture = content.Load<Texture2D>(@"pictures\gb_walk"); this.destinationRect = new Rectangle(x, y, 104, 150); this.sourceRect = new Rectangle(0, 302, 104, 150); this.leftKey = leftKey; this.rightKey = rightKey; this.content = content; this.position = new Vector2(x, y); this.fireballList = new List<Fireball>(); this.demonList = enemy.DemonList; this.game = game; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); this.background = Content.Load<Texture2D>(@"pictures\background"); this.animatedSprite = Content.Load<Texture2D>(@"pictures\gb_walk"); this.position = new Vector2(0f, 0f); this.backgroundDestinationRect = new Rectangle((int)this.position.X, (int)this.position.Y, this.background.Width, this.background.Height); this.backgroundSourceRect = new Rectangle(0, 0, 640, 480); //We roepen de constructor aan van de class this.enemy = new Enemy(Content, new Vector2(500f, 250f)); this.walkingMan = new AnimatedSprite(Content, 0, 260, Keys.A, Keys.S, this.enemy, this); this.arial = Content.Load<SpriteFont>(@"fonts\Arial"); this.score = 0; }