Example #1
0
 public static Entity InvisibleWall(int x, int y)
 {
     var entity = new Entity();
     entity.Transform.Origin = new Vector2f(TILE_SIZE / 2f, TILE_SIZE / 2f);
     entity.Transform.Position = new Vector2f(x * TILE_SIZE, y * TILE_SIZE);
     var hitbox = new FloatRect(0, 0, TILE_SIZE, TILE_SIZE);
     var colider = new ColiderComponent(hitbox);
     var box = new Solid();
     entity.AddComponent(colider);
     entity.AddComponent(box);
     return entity;
 }
Example #2
0
 public static Entity Box(int x, int y)
 {
     var entity = new Entity();
     var texture = ResourceManager.Instance.Get<Texture>("rock" + Randomizer.Generator.Next(1, 3) + ".png");
     entity.Transform.Origin = new Vector2f(texture.Size.X / 2f, texture.Size.Y / 2f);
     entity.Transform.Position = new Vector2f(x * texture.Size.X, y * texture.Size.Y);
     var sprite = new SpriteComponent(texture);
     var hitbox = new FloatRect(0, 0, texture.Size.X, texture.Size.Y);
     var colider = new ColiderComponent(hitbox);
     var box = new Solid();
     entity.AddComponent(sprite);
     entity.AddComponent(colider);
     entity.AddComponent(box);
     return entity;
 }