Skip to content

ECS GraphicsSystem not working #2685

Answered by eonarheim
chrispytoes asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @chrispytoes

This is a good issue!

Actor comes as a pre-baked Entity with a lot of components already added to it, including the TransformComponent and GraphicsComponent. Additionally Excalibur already has the GraphicsSystem added to the ECS world.

So to render the triangle all you need to do is this:

class Game5 {
  public engine: ex.Engine;
  public player: ex.Actor = new ex.Actor({
    width: 128,
    height: 128
  });
  public gameScene: ex.Scene = new ex.Scene();

  constructor() {
    this.player.graphics.use(new ex.Polygon({
      points: [
        ex.vec(-64, -64),
        ex.vec(64, 0),
        ex.vec(-64, 64),
      ],
      color: ex.Color.Red,
      strokeColor: ex.Color.Black

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eonarheim
Comment options

Answer selected by chrispytoes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants