Exemple #1
0
 public Player(ContentManager Content, ParticleTools particleTools, GameUnit x, GameUnit y)
     : base(CollisionType.StickyCollision)
 {
     sprites = new Dictionary<SpriteState, Sprite>();
     InitializeSprites(Content);
     this.particleTools = particleTools;
     kinematicsX = new Kinematics(x, 0);
     kinematicsY = new Kinematics(y, 0);
     accelerationX = 0;
     horizontalFacing = SpriteState.HorizontalFacing.Left;
     intendedVerticalFacing = SpriteState.VerticalFacing.Horizontal;
     walkingAnimation = new WalkingAnimation();
     maybeGroundTile = null;
     jumpActive = false;
     playerHealth = new PlayerHealth(Content);
     interacting = false;
     invincibleTimer = new Timer(InvincibleTime);
     damageText = new FloatingNumber(Content, FloatingNumber.NumberType.Damage);
     experienceText = new FloatingNumber(Content, FloatingNumber.NumberType.Experience);
     gunExperienceHud = new GunExperienceHud(Content);
     polarStar = new PolarStar(Content);
     collisionRectangle = new CompositeCollisionRectangle(new Rectangle((int)Math.Round(CollisionTopLeft), (int)Math.Round(CollisionYTop),
         (int)Math.Round(CollisionTopWidth), (int)Math.Round(CollisionYHeight / 2)),
         new Rectangle((int)Math.Round(CollisionBottomLeft), (int)Math.Round(CollisionYTop + CollisionYHeight / 2),
         (int)Math.Round(CollisionBottomWidth), (int)Math.Round(CollisionYHeight / 2)),
         new Rectangle(6, 10, 10, 12),
         new Rectangle(16, 10, 10, 12));
 }
Exemple #2
0
 public Player(ContentManager Content, ParticleTools particleTools, GameUnit x, GameUnit y) : base(CollisionType.StickyCollision)
 {
     sprites = new Dictionary <SpriteState, Sprite>();
     InitializeSprites(Content);
     this.particleTools     = particleTools;
     kinematicsX            = new Kinematics(x, 0);
     kinematicsY            = new Kinematics(y, 0);
     accelerationX          = 0;
     horizontalFacing       = SpriteState.HorizontalFacing.Left;
     intendedVerticalFacing = SpriteState.VerticalFacing.Horizontal;
     walkingAnimation       = new WalkingAnimation();
     maybeGroundTile        = null;
     jumpActive             = false;
     playerHealth           = new PlayerHealth(Content);
     interacting            = false;
     invincibleTimer        = new Timer(InvincibleTime);
     damageText             = new FloatingNumber(Content, FloatingNumber.NumberType.Damage);
     experienceText         = new FloatingNumber(Content, FloatingNumber.NumberType.Experience);
     gunExperienceHud       = new GunExperienceHud(Content);
     polarStar          = new PolarStar(Content);
     collisionRectangle = new CompositeCollisionRectangle(new Rectangle((int)Math.Round(CollisionTopLeft), (int)Math.Round(CollisionYTop),
                                                                        (int)Math.Round(CollisionTopWidth), (int)Math.Round(CollisionYHeight / 2)),
                                                          new Rectangle((int)Math.Round(CollisionBottomLeft), (int)Math.Round(CollisionYTop + CollisionYHeight / 2),
                                                                        (int)Math.Round(CollisionBottomWidth), (int)Math.Round(CollisionYHeight / 2)),
                                                          new Rectangle(6, 10, 10, 12),
                                                          new Rectangle(16, 10, 10, 12));
 }