Exemple #1
0
 public static Entity Floor(int x, int y)
 {
     var entity = new Entity();
     var texture = ResourceManager.Instance.Get<Texture>("grass_tile.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);
     sprite.Depth = -1;
     entity.AddComponent(sprite);
     return entity;
 }
Exemple #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;
 }
Exemple #3
0
 public static Entity Player(int x, int y)
 {
     var entity = new Entity();
     var texture = ResourceManager.Instance.Get<Texture>("BlueDude.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 player = new Player();
     entity.AddComponent(sprite);
     entity.AddComponent(colider);
     entity.AddComponent(player);
     return entity;
 }