/// <summary> /// Constructor. Can be usd to place the Entity and assign a graphic and mask. /// </summary> /// <param name="x">X position to place the Entity.</param> /// <param name="y">Y position to place the Entity.</param> /// <param name="graphic">Graphic to assign to the Entity.</param> /// <param name="mask">Mask to assign to the Entity.</param> public Entity(float x = 0, float y = 0, Graphic graphic = null, Mask mask = null) { this.x = x; this.y = y; if (graphic != null) { this.graphic = graphic; } if (mask != null) { this.mask = mask; } HITBOX.assignTo(this); _class = this.GetType().FullName; }
/// <summary> /// Adds an Entity to the World with the Graphic object. /// </summary> /// <param name="graphic">Graphic to assign the Entity.</param> /// <param name="layer">Layer of the Entity.</param> /// <param name="x">X position of the Entity.</param> /// <param name="y">Y position of the Entity.</param> /// <returns>The Entity that was added.</returns> public Entity addGraphic(Graphic graphic, int layer = 0, float x = 0, float y = 0) { Entity e = new Entity(x, y, graphic); if (layer != 0) { e.layer = layer; } e.active = false; return add(e); }