Add image to report and to teleport player

This commit is contained in:
Gregoire Parant 2020-10-06 23:56:27 +02:00
parent 8773989bbe
commit c63fb6ed6f
5 changed files with 59 additions and 16 deletions

View file

@ -1,4 +1,5 @@
import LoaderPlugin = Phaser.Loader.LoaderPlugin;
import {PLAYER_RESOURCES, PlayerResourceDescriptionInterface} from "./Character";
export interface BodyResourceDescriptionInterface {
name: string,
@ -310,3 +311,29 @@ export const loadAllLayers = (load: LoaderPlugin) => {
}
}
}
export const OBJECTS: Array<PlayerResourceDescriptionInterface> = [
{name:'report_flag', img:'resources/objects/report_flag.png'},
{name:'layout_modes', img:'resources/objects/layout_modes.png'},
{name:'teleportation', img:'resources/objects/teleportation.png'},
];
export const loadObject = (load: LoaderPlugin) => {
for (let j = 0; j < OBJECTS.length; j++) {
load.spritesheet(
OBJECTS[j].name,
OBJECTS[j].img,
{frameWidth: 32, frameHeight: 32}
)
}
}
export const loadPlayerCharacters = (load: LoaderPlugin) => {
PLAYER_RESOURCES.forEach((playerResource: PlayerResourceDescriptionInterface) => {
load.spritesheet(
playerResource.name,
playerResource.img,
{frameWidth: 32, frameHeight: 32}
);
});
}