Skip to content

Commit 5ce708f

Browse files
committed
- slightly bigger map
1 parent e012a6a commit 5ce708f

File tree

4 files changed

+182
-80
lines changed

4 files changed

+182
-80
lines changed
-30.3 KB
Binary file not shown.

public/assets/tilemaps/forest-map.json

Lines changed: 142 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 673, 554, 611, 582, 0, 0,
3838
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 577, 579, 678, 549, 0,
3939
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 577, 579, 579, 581, 0,
40-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 577, 579, 579, 581, 0,
40+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 577, 579, 579, 581, 3008,
4141
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4242
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4343
0, 0, 0, 0, 0, 157, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -47,6 +47,28 @@
4747
"width":16,
4848
"x":16,
4949
"y":0
50+
},
51+
{
52+
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
54+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61+
0, 0, 0, 2896, 2897, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62+
2164, 0, 0, 2908, 2909, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63+
0, 0, 0, 2920, 2921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64+
0, 0, 0, 2932, 2933, 2992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65+
0, 0, 0, 0, 0, 0, 337, 0, 0, 0, 0, 0, 0, 0, 0, 0,
66+
0, 0, 0, 0, 0, 400, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
67+
0, 0, 0, 0, 0, 0, 2600, 0, 0, 0, 0, 0, 0, 0, 0, 0],
68+
"height":16,
69+
"width":16,
70+
"x":32,
71+
"y":0
5072
}],
5173
"height":16,
5274
"id":3,
@@ -56,7 +78,7 @@
5678
"starty":0,
5779
"type":"tilelayer",
5880
"visible":true,
59-
"width":32,
81+
"width":48,
6082
"x":0,
6183
"y":0
6284
},
@@ -105,6 +127,28 @@
105127
"width":16,
106128
"x":16,
107129
"y":0
130+
},
131+
{
132+
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
134+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
135+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
136+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
137+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
138+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
139+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
141+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
142+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
143+
47, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
144+
79, 327, 328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
145+
79, 359, 271, 271, 271, 271, 536, 537, 0, 0, 0, 0, 0, 0, 0, 0,
146+
79, 79, 79, 79, 79, 387, 388, 0, 0, 0, 0, 0, 0, 0, 0, 0,
147+
79, 79, 79, 79, 79, 419, 420, 2600, 2600, 2600, 2600, 2600, 2600, 0, 0, 0],
148+
"height":16,
149+
"width":16,
150+
"x":32,
151+
"y":0
108152
}],
109153
"height":16,
110154
"id":1,
@@ -114,7 +158,7 @@
114158
"starty":0,
115159
"type":"tilelayer",
116160
"visible":true,
117-
"width":32,
161+
"width":48,
118162
"x":0,
119163
"y":0
120164
},
@@ -163,6 +207,28 @@
163207
"width":16,
164208
"x":16,
165209
"y":0
210+
},
211+
{
212+
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
213+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
214+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
215+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
216+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
217+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
218+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
219+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
220+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
221+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
222+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
223+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
224+
0, 0, 251, 252, 253, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
225+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
226+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
227+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
228+
"height":16,
229+
"width":16,
230+
"x":32,
231+
"y":0
166232
}],
167233
"height":16,
168234
"id":6,
@@ -172,7 +238,7 @@
172238
"starty":0,
173239
"type":"tilelayer",
174240
"visible":true,
175-
"width":32,
241+
"width":48,
176242
"x":0,
177243
"y":0
178244
},
@@ -212,15 +278,37 @@
212278
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
213279
0, 0, 0, 0, 0, 0, 0, 0, 976, 977, 0, 0, 0, 0, 0, 0,
214280
0, 0, 0, 0, 0, 0, 0, 0, 1008, 1009, 2433, 2434, 2435, 0, 0, 0,
215-
0, 0, 0, 784, 785, 786, 0, 0, 1040, 1041, 2472, 2473, 2474, 0, 0, 0,
216-
0, 0, 769, 816, 817, 818, 0, 0, 1072, 1073, 0, 0, 0, 0, 0, 0,
217-
0, 769, 906, 848, 849, 850, 0, 0, 1104, 1105, 0, 0, 0, 0, 0, 0,
218-
773, 801, 835, 880, 901, 0, 0, 2122, 2123, 0, 0, 0, 0, 0, 0, 0,
219-
902, 906, 835, 837, 0, 0, 0, 2161, 2162, 0, 0, 0, 0, 0, 0, 0],
281+
0, 0, 0, 784, 785, 786, 0, 0, 1040, 1041, 2472, 2473, 559, 560, 0, 0,
282+
0, 0, 769, 816, 817, 818, 0, 0, 1072, 1073, 545, 546, 547, 592, 593, 0,
283+
0, 769, 906, 848, 849, 850, 0, 0, 1104, 1105, 577, 610, 610, 624, 625, 626,
284+
773, 801, 835, 880, 901, 0, 0, 2122, 2123, 545, 682, 610, 610, 611, 624, 547,
285+
902, 906, 835, 837, 0, 0, 0, 2161, 2162, 577, 610, 610, 610, 611, 611, 611],
220286
"height":16,
221287
"width":16,
222288
"x":16,
223289
"y":0
290+
},
291+
{
292+
"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
293+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
294+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
295+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
296+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
297+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
298+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
299+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
300+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
301+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
302+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
303+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
304+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
305+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
306+
549, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
307+
581, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
308+
"height":16,
309+
"width":16,
310+
"x":32,
311+
"y":0
224312
}],
225313
"height":16,
226314
"id":9,
@@ -230,7 +318,7 @@
230318
"starty":0,
231319
"type":"tilelayer",
232320
"visible":true,
233-
"width":32,
321+
"width":48,
234322
"x":0,
235323
"y":0
236324
},
@@ -301,7 +389,7 @@
301389
"rotation":0,
302390
"type":"collider",
303391
"visible":true,
304-
"width":193.535666666667,
392+
"width":226.410666666667,
305393
"x":830.5655,
306394
"y":352.333333333333
307395
},
@@ -315,6 +403,28 @@
315403
"width":158.202333333333,
316404
"x":833.232166666667,
317405
"y":223
406+
},
407+
{
408+
"height":66.4978,
409+
"id":21,
410+
"name":"ground",
411+
"rotation":0,
412+
"type":"collider",
413+
"visible":true,
414+
"width":32.0614,
415+
"x":1056.8443,
416+
"y":352.3136
417+
},
418+
{
419+
"height":29,
420+
"id":22,
421+
"name":"ground",
422+
"rotation":0,
423+
"type":"collider",
424+
"visible":true,
425+
"width":190.642,
426+
"x":1088.429,
427+
"y":418.5
318428
}],
319429
"opacity":1,
320430
"type":"objectgroup",
@@ -378,6 +488,26 @@
378488
"width":0,
379489
"x":981.333333333333,
380490
"y":204.666666666667
491+
},
492+
{
493+
"height":0,
494+
"id":23,
495+
"name":"pixie_ennemy_tag",
496+
"polyline":[
497+
{
498+
"x":0,
499+
"y":0
500+
},
501+
{
502+
"x":-131.334,
503+
"y":1.33333
504+
}],
505+
"rotation":0,
506+
"type":"ennemy_patrol",
507+
"visible":true,
508+
"width":0,
509+
"x":1255.5,
510+
"y":401.5
381511
}],
382512
"opacity":1,
383513
"type":"objectgroup",
@@ -386,7 +516,7 @@
386516
"y":0
387517
}],
388518
"nextlayerid":10,
389-
"nextobjectid":21,
519+
"nextobjectid":24,
390520
"orientation":"orthogonal",
391521
"renderorder":"right-down",
392522
"tiledversion":"1.11.0",

src/game-objects/ennemy.game-object.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class Ennemy extends Sprite {
6262
this.stopPatrol();
6363
this.chasePlayer();
6464
} //
65-
else if (distanceToPlayer > this._config.chaseDistance && this._patrolTween === null) {
65+
else if (distanceToPlayer > this._config.chaseDistance && !this._isPatrolling) {
6666
this.returnToStart();
6767
}
6868

@@ -77,6 +77,7 @@ export class Ennemy extends Sprite {
7777
if (this._config.hp <= 0) {
7878
this.anims.play(AnimationTag.ENNEMY_DEATH);
7979
this.body.setVelocityX(0);
80+
this.body.setEnable(false);
8081
this.on("animationcomplete", () => this.destroy());
8182
this.scene.sound.play(SfxTag.PIXIE_DEAD);
8283
} else {
@@ -116,12 +117,12 @@ export class Ennemy extends Sprite {
116117
}
117118

118119
private returnToStart(): void {
119-
if (!GameHelper.isCloseEnough(this.x, this._startingX)) {
120-
const direction = Math.sign(this._startingX - this.x);
121-
this.body.setVelocityX(direction * this._config.patrolSpeed);
122-
} else {
120+
if (GameHelper.isCloseEnough(this.x, this._startingX)) {
123121
this.body.setVelocityX(0);
124122
this.startPatrol();
123+
} else {
124+
const direction = Math.sign(this._startingX - this.x);
125+
this.body.setVelocityX(direction * this._config.patrolSpeed);
125126
}
126127
}
127128

0 commit comments

Comments
 (0)