-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathimage.example.js
More file actions
28 lines (26 loc) · 788 Bytes
/
Copy pathimage.example.js
File metadata and controls
28 lines (26 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Scene from '../lib/scene.js';
import V2 from '../geo/v2.js';
import graphic from '../core/graphic.js';
import ImageEntity from './image.js';
class BasicExampleScene extends Scene {
constructor() {
super();
const img = 'examples/gold.png';
// Add image to graphics manager
graphic.add(img);
// Preload the image, usually done during game init
graphic.load(() => {
// Add image unscaled
this.add(new ImageEntity(new V2(380, 150), img));
// Add image with scale
this.add(new ImageEntity(new V2(360, 300), img, 2));
});
}
}
export default [
{
title: "Basic Example",
description: "Preload and display images",
scene: BasicExampleScene
}
];