public Player(SpriteBatch spriteBatch, Level level) { this.spriteBatch = spriteBatch; this.level = level; this.position = this.level.startPosition; this.target = this.position; this.width = texture.Width / 3; this.height = texture.Height / 4; this.path = new List<Vector2>(); pathIndex = 0; this.direction = Vector2.UnitY; this.frame = new Rectangle(0, 0, width, height); this.frameTimer = new Timer(1000 / FPS); this.skillTimer = new Timer(SKILL_DELAY); this.skills = new List<Skill>(); curSkill = Skill.Type.FireBall; }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to Draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); selectedTexture = Content.Load<Texture2D>("selected"); Level.textures = new List<Random.Texture>(); Level.textures.Add(new Texture(Content.Load<Texture2D>("ground"), true)); Level.textures.Add(new Texture(Content.Load<Texture2D>("wall"), false)); Player.texture = Content.Load<Texture2D>("player"); Skill.textures = new List<Texture2D> { Content.Load<Texture2D>("fireball"), }; level = new Level(spriteBatch); player = new Player(spriteBatch, level); level.player = player; }