Step 3 - The Bird and the Ground
Let's create some ground for the Bird to collide with, make a new ground.ts file.
We can use the anchor property to tell Excalibur how to align the default graphics and collider (0, 0) means top left, by default graphics and collider are centered around the position pos.
typescript
typescript
We can make our Bird move by giving it some acceleration in onInitialize, it is generally recommended to initialize state in onInitialize. It makes testing easier and defers initialization until excalibur primitives are available. onInitialize is called once before the first update of the Actor.
BTW in Excalibur the positive y axis points down!
typescript
typescript
Now we want to collide with the Ground.
typescript
typescript
Let's put our Bird and Ground together in the default Scene
typescript
typescript