3
3
var game = new ex . Engine ( {
4
4
width : 600 ,
5
5
height : 600 ,
6
- pixelArt : true
6
+ pixelArt : true ,
7
+ displayMode : ex . DisplayMode . FitScreenAndFill
7
8
} ) ;
8
9
9
10
game . showDebug ( true ) ;
@@ -24,15 +25,19 @@ var ss = ex.SpriteSheet.fromImageSource({
24
25
25
26
var tm = new ex . TileMap ( {
26
27
pos : ex . vec ( - 100 , - 100 ) ,
27
- tileWidth : 16 ,
28
- tileHeight : 16 ,
28
+ tileWidth : 16 * 20 ,
29
+ tileHeight : 16 * 20 ,
29
30
columns : 40 ,
30
31
rows : 40
31
32
} ) ;
32
- tm . transform . scale = ex . vec ( 2 , 2 ) ;
33
+
34
+ //tm.addComponent(new ex.ParallaxComponent(ex.vec(.4, .4)));
35
+ //tm.transform.scale = ex.vec(2, 2);
33
36
// tm.transform.rotation = Math.PI / 4;
34
37
35
38
var tileSprite = ss . sprites [ 0 ] ;
39
+ tileSprite . destSize . width = 320 ;
40
+ tileSprite . destSize . height = 320 ;
36
41
37
42
for ( var i = 0 ; i < tm . columns * tm . rows ; i ++ ) {
38
43
tm . getTileByIndex ( i ) . addGraphic ( tileSprite ) ;
@@ -54,8 +59,23 @@ game.input.pointers.primary.on('down', (evt: ex.PointerEvent) => {
54
59
game . start ( loader ) . then ( async ( ) => {
55
60
await game . currentScene . camera . move ( ex . Vector . Zero . clone ( ) , 2000 , ex . EasingFunctions . EaseInOutCubic ) ;
56
61
console . log ( tm . getOnScreenTiles ( ) ) ;
57
- await game . currentScene . camera . move ( new ex . Vector ( 200 , 600 ) , 2000 , ex . EasingFunctions . EaseInOutCubic ) ;
62
+ await game . currentScene . camera . move ( new ex . Vector ( 800 , 600 ) , 4000 , ex . EasingFunctions . EaseInOutCubic ) ;
58
63
console . log ( tm . getOnScreenTiles ( ) ) ;
64
+
65
+ await ex . coroutine (
66
+ game ,
67
+ function * ( ) {
68
+ let duration = 2000 ;
69
+ while ( duration >= 0 ) {
70
+ const elapsed = yield ;
71
+
72
+ game . currentScene . camera . rotation = ex . lerpAngle ( 0 , Math . PI , ex . RotationType . ShortestPath , ex . clamp ( 1 - duration / 2000 , 0 , 1 ) ) ;
73
+
74
+ duration -= elapsed ;
75
+ }
76
+ } . bind ( this )
77
+ ) ;
78
+
59
79
await game . currentScene . camera . zoomOverTime ( 2 , 1000 ) ;
60
80
console . log ( tm . getOnScreenTiles ( ) ) ;
61
81
await game . currentScene . camera . zoomOverTime ( 1 , 1000 ) ;
0 commit comments