Пример #1
0
 /// <summary>
 /// Constructs a new entity.
 /// Every entity will have a default Circle hitbox of size 10 right at the center of the entity.
 /// Hitboxes cannot be null. If you want an entity without a hitbox, make a Polyhitbox and 
 /// do not add anything to it.
 /// Hp is set to 1 and mp is set to 0 by default.
 /// Use the properties HP and MP to edit.
 /// </summary>
 /// <param name="w">Width of the entity</param>
 /// <param name="h">Height of the entity</param>
 /// <param name="x">(Optional)X coordinate of the upper left corner of the entity. Defaults to 0 if not set.</param>
 /// <param name="y">(Optional)Y coordinate of the upper left corner of the entity. Defaults to 0 if not set.</param>
 public Entity(Image img)
 {
     this.loc = new Point(0,0);
     hp = 1;
     mp = 0;
     baseSpeed = 10;
     this.img = img;
     hitbox = new CircleHitbox(this, img.Width / 2, img.Height / 2, 10);
     currentTeam = Team.NEUTRAL;
     hitbox.setHitboxColor(Color.Gray, Color.White);
     Updater.register(this);
 }
Пример #2
0
 public Entity(Image img, Point loc, Hitbox hb, bool collidable = false,int hp = 1, int mp = 0,int baseSpeed = 10, Team team = Team.NEUTRAL)
 {
     this.loc = loc;
     this.hp = hp;
     shownHP = hp;
     currentHP = hp;
     this.mp = mp;
     shownMP = mp;
     currentMP = mp;
     this.hitbox = hb;
     this.baseSpeed = baseSpeed;
     currentTeam = team;
     hb.setHitboxColor(Color.Gray, Color.White);
     Updater.register(this, collidable);
 }