public Player(Game game, Character character) { gameRef = (Game1)game; camera = new Camera(gameRef.ScreenRectangle); this.character = character; Sprite.Position = new Vector2(1000, 1000); }
public void SetTarget(Character character) { target = character; foreach (SkillLabelSet set in skillLabels) { set.SkillValue = target.Entity.Skills[set.Label.Text].SkillValue; set.SkillLabel.Text = set.SkillValue.ToString(); } }
private void CreatePlayer() { Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>(); Animation animation = new Animation(3, 32, 32, 0, 0); animations.Add(AnimationKey.Down, animation); animation = new Animation(3, 32, 32, 0, 32); animations.Add(AnimationKey.Left, animation); animation = new Animation(3, 32, 32, 0, 64); animations.Add(AnimationKey.Right, animation); animation = new Animation(3, 32, 32, 0, 96); animations.Add(AnimationKey.Up, animation); AnimatedSprite sprite = new AnimatedSprite( GameRef.Content.Load<Texture2D>(@"PlayerSprites\malefighter"), animations); Entity entity = new Entity( "Encelwyn", DataManager.EntityData["Fighter"], EntityGender.Male, EntityType.Character); Character character = new Character(entity, sprite); GamePlayScreen.Player = new Player(GameRef, character); }
private void CreatePlayer() { Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>(); Animation animation = new Animation(3, 32, 32, 0, 0); animations.Add(AnimationKey.Down, animation); animation = new Animation(3, 32, 32, 0, 32); animations.Add(AnimationKey.Left, animation); animation = new Animation(3, 32, 32, 0, 64); animations.Add(AnimationKey.Right, animation); animation = new Animation(3, 32, 32, 0, 96); animations.Add(AnimationKey.Up, animation); AnimatedSprite sprite = new AnimatedSprite( characterImages[genderSelector.SelectedIndex, classSelector.SelectedIndex], animations); EntityGender gender = EntityGender.Male; if (genderSelector.SelectedIndex == 1) gender = EntityGender.Female; Entity entity = new Entity( "Pat", DataManager.EntityData[classSelector.SelectedItem], gender, EntityType.Character); foreach (string s in DataManager.SkillData.Keys) { Skill skill = Skill.FromSkillData(DataManager.SkillData[s]); entity.Skills.Add(s, skill); } Character character = new Character(entity, sprite); GamePlayScreen.Player = new Player(GameRef, character); }
public Player(Game game, Character character) { gameRef = (Game1)game; camera = new Camera(gameRef.ScreenRectangle); this.character = character; }
public Enemy(Game game, Character character, Player player) { _gameRef = (Game1) game; _character = character; _player = player; }
protected override void LoadContent() { var animations = new Dictionary<AnimationKey, Animation>(); _enemies = new List<Enemy>(); var animation = new Animation(3, 32, 32, 0, 0); animations.Add(AnimationKey.Down, animation); animation = new Animation(3, 32, 32, 0, 32); animations.Add(AnimationKey.Left, animation); animation = new Animation(3, 32, 32, 0, 64); animations.Add(AnimationKey.Right, animation); animation = new Animation(3, 32, 32, 0, 96); animations.Add(AnimationKey.Up, animation); var sprite = new AnimatedSprite(@"PlayerSprites\malepriest", animations, 200.0f, 1.5f); var enemsprite = new AnimatedSprite(@"PlayerSprites\femalepriest", animations, 100.0f, 2.0f); var enemsprite2 = new AnimatedSprite(@"PlayerSprites\femalefighter", animations, 50.0f, 2.0f); sprite.Position = new Vector2(300, 300); enemsprite2.Position = new Vector2(0, 500); var character = new Character(sprite, 40, 1); var enemcharacter1 = new Character(enemsprite, 20, 10); var enemcharacter2 = new Character(enemsprite2, 30, 50); _player = new Player(GameRef, character); _enemies.Add(new Enemy(GameRef, enemcharacter1, _player)); _enemies.Add(new Enemy(GameRef, enemcharacter2, _player)); _player.LoadContent(GameRef.Content); foreach (var enemy in _enemies) enemy.LoadContent(GameRef.Content); _collisionHandler = new CollisionHandler(GameRef, _player, _enemies); base.LoadContent(); }
public Player(Game game, Character character) { _gameRef = (Game1) game; _character = character; }