Step 11 - Images and Graphics
It would be nice to have some graphics for our Bird actor, we can load images to use in in actors using the ex.ImageSource and a ex.Loader. The loader will show a loading bar while our images and other resources are loading. Generally we do this in a new resources.ts file.
- We export the Resources as constso you get strong typing for each key of the dictionary,as consttells typescript that the keys wont change at runtime
- Another useful convention that we use is defining the loader next to the Resources and exporting to be used in main.ts
- Note: in vite to serve static files we use the publicfolder
typescript
typescript
Now we can load this before starting the game
typescript
typescript