Refactor game map to use tileset format, add sea shell object spawning, implement audio effects for chopping and inventory actions, update scene configuration for proper scaling and centering.
This commit is contained in:
parent
8a386a4789
commit
51e919b8aa
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,440 +1,162 @@
|
||||||
{ "compressionlevel":-1,
|
{ "columns":10,
|
||||||
"height":40,
|
"image":"images\/terrain.png",
|
||||||
"infinite":true,
|
"imageheight":1000,
|
||||||
"layers":[
|
"imagewidth":1000,
|
||||||
{
|
"margin":0,
|
||||||
"chunks":[
|
"name":"terrain",
|
||||||
{
|
"spacing":0,
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
"tilecount":100,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 5,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 5,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, 5, 5,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, 5, 5, 2,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 5, 5, 4, 2,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 5, 4, 4, 2],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":0,
|
|
||||||
"y":0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 17, 17, 17, 17, 17,
|
|
||||||
1, 1, 1, 1, 1, 1, 3, 3, 17, 17, 17, 17, 15, 15, 15, 15,
|
|
||||||
1, 1, 1, 1, 1, 3, 3, 17, 17, 17, 17, 17, 17, 17, 15, 15,
|
|
||||||
1, 1, 3, 3, 3, 3, 3, 3, 17, 17, 17, 17, 17, 17, 17, 17,
|
|
||||||
3, 3, 3, 3, 3, 3, 13, 13, 13, 17, 17, 17, 17, 17, 17, 17,
|
|
||||||
3, 3, 3, 3, 13, 13, 13, 13, 13, 2, 2, 2, 2, 17, 17, 17,
|
|
||||||
3, 3, 3, 3, 13, 13, 13, 13, 2, 2, 2, 2, 2, 2, 17, 17,
|
|
||||||
3, 3, 3, 5, 13, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":16,
|
|
||||||
"y":0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[17, 17, 17, 17, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7,
|
|
||||||
15, 15, 15, 17, 17, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
|
|
||||||
15, 15, 15, 15, 17, 17, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7,
|
|
||||||
15, 15, 15, 15, 15, 17, 13, 13, 13, 5, 5, 5, 6, 6, 6, 6,
|
|
||||||
15, 15, 15, 15, 17, 17, 13, 13, 13, 13, 13, 13, 5, 5, 6, 6,
|
|
||||||
17, 17, 17, 17, 17, 17, 13, 2, 2, 2, 2, 13, 13, 5, 5, 6,
|
|
||||||
17, 17, 17, 17, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 5, 5,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 5, 5,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 5, 5,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 14, 14, 14,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 14, 14, 15, 15, 14],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":32,
|
|
||||||
"y":0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 0, 0, 0, 0,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 0, 0, 0, 0,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 2, 0, 0, 0, 0,
|
|
||||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 2, 0, 0, 0, 0,
|
|
||||||
6, 7, 7, 7, 7, 7, 7, 7, 6, 6, 2, 2, 0, 0, 0, 0,
|
|
||||||
6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 2, 2, 0, 0, 0, 0,
|
|
||||||
6, 6, 7, 7, 7, 7, 7, 6, 7, 7, 2, 2, 0, 0, 0, 0,
|
|
||||||
6, 6, 6, 6, 7, 7, 6, 6, 7, 7, 2, 2, 0, 0, 0, 0,
|
|
||||||
5, 6, 6, 6, 6, 6, 6, 8, 7, 7, 2, 2, 0, 0, 0, 0,
|
|
||||||
5, 5, 6, 6, 6, 16, 8, 8, 8, 2, 2, 2, 0, 0, 0, 0,
|
|
||||||
5, 5, 16, 16, 16, 16, 8, 8, 8, 2, 2, 2, 0, 0, 0, 0,
|
|
||||||
13, 16, 16, 16, 16, 16, 8, 8, 2, 2, 2, 2, 0, 0, 0, 0,
|
|
||||||
13, 16, 16, 16, 17, 17, 8, 2, 2, 2, 2, 2, 0, 0, 0, 0,
|
|
||||||
13, 13, 16, 17, 17, 15, 15, 2, 2, 2, 2, 2, 0, 0, 0, 0,
|
|
||||||
13, 13, 17, 17, 17, 15, 15, 12, 12, 12, 2, 2, 0, 0, 0, 0,
|
|
||||||
14, 13, 17, 17, 15, 15, 15, 12, 11, 12, 12, 12, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":48,
|
|
||||||
"y":0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 5, 4, 4, 2,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 5, 4, 4, 2,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 5, 4, 4, 4,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 3, 5, 4, 4, 4,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, 5, 4, 4,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 5, 5, 4,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 3, 3, 5, 5,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 12, 3, 3, 5,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 12, 12, 3, 3,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 12, 12, 3,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 12, 12, 12,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11, 12, 12,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 12, 12,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 11,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 11],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":0,
|
|
||||||
"y":16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
||||||
5, 4, 4, 4, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 2,
|
|
||||||
5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 3, 5, 2,
|
|
||||||
3, 5, 5, 5, 5, 3, 3, 3, 12, 12, 12, 12, 12, 3, 5, 5,
|
|
||||||
12, 3, 3, 3, 3, 3, 12, 12, 11, 11, 11, 11, 12, 12, 3, 3,
|
|
||||||
12, 12, 3, 3, 12, 12, 11, 11, 11, 11, 11, 12, 12, 12, 3, 3,
|
|
||||||
12, 12, 12, 12, 12, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 3,
|
|
||||||
11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
|
||||||
11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11,
|
|
||||||
11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":16,
|
|
||||||
"y":16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 14, 15, 15, 15, 15,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 14, 14, 15, 15, 15, 15,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 14, 15, 15, 15, 15, 15,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 14, 13, 15, 15, 15, 15,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 14, 14, 15, 15, 15, 15,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 14, 15, 15, 15, 15,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 14, 14, 14, 14, 14,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 13, 13, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 13, 13, 3, 13,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 13, 3, 3, 3, 3,
|
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 13, 13, 3, 3, 1, 1, 1,
|
|
||||||
2, 2, 2, 2, 2, 2, 3, 2, 3, 3, 3, 1, 1, 1, 1, 1,
|
|
||||||
3, 3, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
12, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
11, 3, 11, 11, 11, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
11, 11, 11, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":32,
|
|
||||||
"y":16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[14, 14, 17, 17, 15, 15, 15, 12, 11, 11, 11, 11, 0, 0, 0, 0,
|
|
||||||
15, 14, 14, 17, 15, 15, 12, 11, 11, 11, 11, 11, 0, 0, 0, 0,
|
|
||||||
15, 15, 14, 3, 17, 12, 11, 11, 11, 11, 11, 11, 0, 0, 0, 0,
|
|
||||||
15, 15, 14, 3, 12, 11, 11, 11, 11, 11, 1, 1, 0, 0, 0, 0,
|
|
||||||
14, 14, 14, 3, 11, 11, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
14, 13, 13, 11, 11, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
14, 13, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
13, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":48,
|
|
||||||
"y":16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":0,
|
|
||||||
"y":32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
|
||||||
11, 11, 11, 1, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 1, 1,
|
|
||||||
11, 11, 1, 1, 1, 1, 1, 11, 11, 11, 11, 11, 11, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 11, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":16,
|
|
||||||
"y":32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":32,
|
|
||||||
"y":32
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
"height":16,
|
|
||||||
"width":16,
|
|
||||||
"x":48,
|
|
||||||
"y":32
|
|
||||||
}],
|
|
||||||
"height":48,
|
|
||||||
"id":1,
|
|
||||||
"name":"main",
|
|
||||||
"opacity":1,
|
|
||||||
"startx":0,
|
|
||||||
"starty":0,
|
|
||||||
"type":"tilelayer",
|
|
||||||
"visible":true,
|
|
||||||
"width":64,
|
|
||||||
"x":0,
|
|
||||||
"y":0
|
|
||||||
}],
|
|
||||||
"nextlayerid":2,
|
|
||||||
"nextobjectid":1,
|
|
||||||
"orientation":"orthogonal",
|
|
||||||
"renderorder":"right-down",
|
|
||||||
"tiledversion":"1.11.2",
|
"tiledversion":"1.11.2",
|
||||||
"tileheight":100,
|
"tileheight":100,
|
||||||
"tilesets":[
|
"tiles":[
|
||||||
{
|
{
|
||||||
"columns":10,
|
"id":0,
|
||||||
"firstgid":1,
|
"properties":[
|
||||||
"image":"images\/terrain.png",
|
|
||||||
"imageheight":1000,
|
|
||||||
"imagewidth":1000,
|
|
||||||
"margin":0,
|
|
||||||
"name":"terrain",
|
|
||||||
"spacing":0,
|
|
||||||
"tilecount":100,
|
|
||||||
"tileheight":100,
|
|
||||||
"tiles":[
|
|
||||||
{
|
{
|
||||||
"id":0,
|
"name":"collides",
|
||||||
"properties":[
|
"type":"bool",
|
||||||
{
|
"value":true
|
||||||
"name":"collides",
|
}]
|
||||||
"type":"bool",
|
},
|
||||||
"value":true
|
{
|
||||||
}]
|
"id":1,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"forestTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":40
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":2,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"forestTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":2
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":3,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"forestTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":1,
|
"name":"palmTree",
|
||||||
"properties":[
|
"type":"int",
|
||||||
{
|
"value":2
|
||||||
"name":"forestTree",
|
}]
|
||||||
"type":"int",
|
},
|
||||||
"value":40
|
{
|
||||||
}]
|
"id":4,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"forestTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":0
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":7,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"forestTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":8
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":8,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"forestTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":2,
|
"name":"palmTree",
|
||||||
"properties":[
|
"type":"int",
|
||||||
{
|
"value":2
|
||||||
"name":"forestTree",
|
}]
|
||||||
"type":"int",
|
},
|
||||||
"value":2
|
{
|
||||||
}]
|
"id":10,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"fish",
|
||||||
|
"type":"int",
|
||||||
|
"value":6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":3,
|
"name":"palmTree",
|
||||||
"properties":[
|
"type":"int",
|
||||||
{
|
"value":15
|
||||||
"name":"forestTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":5
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"palmTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":2
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":4,
|
"name":"rock",
|
||||||
"properties":[
|
"type":"int",
|
||||||
{
|
"value":6
|
||||||
"name":"forestTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":0
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":7,
|
"name":"seaShell",
|
||||||
"properties":[
|
"type":"int",
|
||||||
{
|
"value":8
|
||||||
"name":"forestTree",
|
}]
|
||||||
"type":"int",
|
},
|
||||||
"value":8
|
{
|
||||||
}]
|
"id":11,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"palmTree",
|
||||||
|
"type":"int",
|
||||||
|
"value":10
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":12,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"boulder",
|
||||||
|
"type":"int",
|
||||||
|
"value":2
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":13,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"boulder",
|
||||||
|
"type":"int",
|
||||||
|
"value":8
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":14,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"boulder",
|
||||||
|
"type":"int",
|
||||||
|
"value":20
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":16,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"boulder",
|
||||||
|
"type":"int",
|
||||||
|
"value":15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id":8,
|
"name":"forestTree",
|
||||||
"properties":[
|
"type":"int",
|
||||||
{
|
"value":2
|
||||||
"name":"forestTree",
|
}]
|
||||||
"type":"int",
|
|
||||||
"value":15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"palmTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":2
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":10,
|
|
||||||
"properties":[
|
|
||||||
{
|
|
||||||
"name":"palmTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":15
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":11,
|
|
||||||
"properties":[
|
|
||||||
{
|
|
||||||
"name":"palmTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":10
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":12,
|
|
||||||
"properties":[
|
|
||||||
{
|
|
||||||
"name":"boulder",
|
|
||||||
"type":"int",
|
|
||||||
"value":2
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":13,
|
|
||||||
"properties":[
|
|
||||||
{
|
|
||||||
"name":"boulder",
|
|
||||||
"type":"int",
|
|
||||||
"value":8
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":14,
|
|
||||||
"properties":[
|
|
||||||
{
|
|
||||||
"name":"boulder",
|
|
||||||
"type":"int",
|
|
||||||
"value":20
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":16,
|
|
||||||
"properties":[
|
|
||||||
{
|
|
||||||
"name":"boulder",
|
|
||||||
"type":"int",
|
|
||||||
"value":15
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name":"forestTree",
|
|
||||||
"type":"int",
|
|
||||||
"value":2
|
|
||||||
}]
|
|
||||||
}],
|
|
||||||
"tilewidth":100
|
|
||||||
}],
|
}],
|
||||||
"tilewidth":100,
|
"tilewidth":100,
|
||||||
"type":"map",
|
"type":"tileset",
|
||||||
"version":"1.10",
|
"version":"1.10"
|
||||||
"width":60
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 836 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 180 KiB |
Binary file not shown.
Binary file not shown.
16
index.html
16
index.html
|
|
@ -5,20 +5,8 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Fablewood - Survival Crafting Game</title>
|
<title>Fablewood - Survival Crafting Game</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body { margin: 0; background-color: black; }
|
||||||
margin: 0;
|
canvas { display: block; }
|
||||||
padding: 0;
|
|
||||||
background-color: #1a1a1a;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#game-container {
|
|
||||||
border: 2px solid #4a752c;
|
|
||||||
box-shadow: 0 0 20px rgba(74, 117, 44, 0.5);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,10 @@
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="10">
|
<tile id="10">
|
||||||
<properties>
|
<properties>
|
||||||
|
<property name="fish" type="int" value="6"/>
|
||||||
<property name="palmTree" type="int" value="15"/>
|
<property name="palmTree" type="int" value="15"/>
|
||||||
|
<property name="rock" type="int" value="6"/>
|
||||||
|
<property name="seaShell" type="int" value="8"/>
|
||||||
</properties>
|
</properties>
|
||||||
</tile>
|
</tile>
|
||||||
<tile id="11">
|
<tile id="11">
|
||||||
|
|
|
||||||
BIN
raw/objects.psd
BIN
raw/objects.psd
Binary file not shown.
|
|
@ -1,11 +1,14 @@
|
||||||
import { Game } from './scenes/Game.js';
|
import { Game } from './scenes/Game.js';
|
||||||
|
import { MenuScene } from './scenes/MenuScene.js';
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
type: Phaser.AUTO,
|
type: Phaser.AUTO,
|
||||||
scale: {
|
scale: {
|
||||||
mode: Phaser.Scale.RESIZE,
|
mode: Phaser.Scale.FIT,
|
||||||
|
autoCenter: Phaser.Scale.CENTER_BOTH,
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720,
|
height: 720,
|
||||||
|
parent: 'game-container'
|
||||||
},
|
},
|
||||||
physics: {
|
physics: {
|
||||||
default: 'arcade',
|
default: 'arcade',
|
||||||
|
|
@ -17,7 +20,7 @@ const config = {
|
||||||
},
|
},
|
||||||
backgroundColor: '#000000',
|
backgroundColor: '#000000',
|
||||||
scene: [
|
scene: [
|
||||||
// MenuScene,
|
MenuScene,
|
||||||
// Intro,
|
// Intro,
|
||||||
// Tutorial,
|
// Tutorial,
|
||||||
Game
|
Game
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,7 @@ export class ObjectManager {
|
||||||
const objectType = tile.properties;
|
const objectType = tile.properties;
|
||||||
|
|
||||||
Object.keys(objectType).forEach(key => {
|
Object.keys(objectType).forEach(key => {
|
||||||
const rand = Phaser.Math.Between(1,300);
|
if (key === 'palmTree' && Phaser.Math.Between(1,300) <= objectType[key]) {
|
||||||
|
|
||||||
if (key === 'palmTree' && rand <= objectType[key]) {
|
|
||||||
const palmTree = this.scene.physics.add.sprite(x, y, 'objects', 0);
|
const palmTree = this.scene.physics.add.sprite(x, y, 'objects', 0);
|
||||||
this.scene.objects.add(palmTree);
|
this.scene.objects.add(palmTree);
|
||||||
palmTree.setImmovable(true).setSize(60,100);
|
palmTree.setImmovable(true).setSize(60,100);
|
||||||
|
|
@ -47,7 +45,7 @@ export class ObjectManager {
|
||||||
doneSprite: 10
|
doneSprite: 10
|
||||||
};
|
};
|
||||||
this.createHealthBar(palmTree);
|
this.createHealthBar(palmTree);
|
||||||
} else if (key === 'forestTree' && rand <= objectType[key]) {
|
} else if (key === 'forestTree' && Phaser.Math.Between(1,300) <= objectType[key]) {
|
||||||
const forestRand = Phaser.Math.Between(1,4);
|
const forestRand = Phaser.Math.Between(1,4);
|
||||||
const forestTree = this.scene.physics.add.sprite(x, y, 'objects', forestRand);
|
const forestTree = this.scene.physics.add.sprite(x, y, 'objects', forestRand);
|
||||||
this.scene.objects.add(forestTree);
|
this.scene.objects.add(forestTree);
|
||||||
|
|
@ -61,7 +59,7 @@ export class ObjectManager {
|
||||||
doneSprite: 11
|
doneSprite: 11
|
||||||
};
|
};
|
||||||
this.createHealthBar(forestTree);
|
this.createHealthBar(forestTree);
|
||||||
} else if (key === 'boulder' && rand <= objectType[key]) {
|
} else if (key === 'boulder' && Phaser.Math.Between(1,300) <= objectType[key]) {
|
||||||
const boulder = this.scene.physics.add.sprite(x, y, 'objects', 20);
|
const boulder = this.scene.physics.add.sprite(x, y, 'objects', 20);
|
||||||
this.scene.objects.add(boulder);
|
this.scene.objects.add(boulder);
|
||||||
boulder.setImmovable(true);
|
boulder.setImmovable(true);
|
||||||
|
|
@ -74,6 +72,19 @@ export class ObjectManager {
|
||||||
doneSprite: null
|
doneSprite: null
|
||||||
};
|
};
|
||||||
this.createHealthBar(boulder);
|
this.createHealthBar(boulder);
|
||||||
|
} else if (key === 'seaShell' && Phaser.Math.Between(1,300) <= objectType[key]) {
|
||||||
|
const item = this.scene.physics.add.sprite(x, y, 'objects', 5);
|
||||||
|
this.scene.objects.add(item);
|
||||||
|
item.setImmovable(true);
|
||||||
|
item.props = {
|
||||||
|
type: key,
|
||||||
|
health: 1,
|
||||||
|
fullHealth: 1,
|
||||||
|
yield: 'seaShell',
|
||||||
|
amount: [1,1],
|
||||||
|
doneSprite: null
|
||||||
|
};
|
||||||
|
this.createHealthBar(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -148,9 +159,11 @@ export class ObjectManager {
|
||||||
switch (object.props.type){
|
switch (object.props.type){
|
||||||
case 'palmTree':
|
case 'palmTree':
|
||||||
object.props.health -= dmg;
|
object.props.health -= dmg;
|
||||||
|
this.scene.sound.play('chop');
|
||||||
break;
|
break;
|
||||||
case 'forestTree':
|
case 'forestTree':
|
||||||
object.props.health -= dmg;
|
object.props.health -= dmg;
|
||||||
|
this.scene.sound.play('chop');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@ export class Game extends Phaser.Scene {
|
||||||
this.load.image('terrain-tileset', 'assets/images/terrain.png');
|
this.load.image('terrain-tileset', 'assets/images/terrain.png');
|
||||||
this.load.image('backpack', 'assets/images/backpack.png');
|
this.load.image('backpack', 'assets/images/backpack.png');
|
||||||
|
|
||||||
// Fonts
|
// FX
|
||||||
this.load.font('eraserDust', 'assets/fonts/EraserDust.ttf');
|
this.load.audio('chop', 'assets/fx/chop.mp3');
|
||||||
|
this.load.audio('zip', 'assets/fx/zip.mp3');
|
||||||
|
this.load.audio('inventory', 'assets/fx/inventory.mp3');
|
||||||
|
|
||||||
// Music
|
// Music
|
||||||
this.load.audio('bgMusic', 'assets/music/bgMusic.mp3');
|
this.load.audio('bgMusic', 'assets/music/bgMusic.mp3');
|
||||||
|
|
@ -76,12 +78,14 @@ export class Game extends Phaser.Scene {
|
||||||
player.stop();
|
player.stop();
|
||||||
this.inventoryManager.addItem(item);
|
this.inventoryManager.addItem(item);
|
||||||
const cam = this.cameras.main.worldView;
|
const cam = this.cameras.main.worldView;
|
||||||
|
this.sound.play('zip');
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
targets: item,
|
targets: item,
|
||||||
x: cam.x+cam.width-150,
|
x: cam.x+cam.width-150,
|
||||||
y: cam.y+cam.height-150,
|
y: cam.y+cam.height-150,
|
||||||
duration: 500,
|
duration: 500,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
|
this.sound.play('inventory');
|
||||||
item.destroy();
|
item.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
export class MenuScene extends Phaser.Scene {
|
||||||
|
constructor() {
|
||||||
|
super({ key: 'MenuScene' });
|
||||||
|
}
|
||||||
|
|
||||||
|
preload() {
|
||||||
|
// Images
|
||||||
|
this.load.image('logo', 'assets/images/logo.png');
|
||||||
|
|
||||||
|
// Fonts
|
||||||
|
this.load.font('eraserDust', 'assets/fonts/EraserDust.ttf');
|
||||||
|
|
||||||
|
// Videos
|
||||||
|
this.load.video('mainMenu', 'assets/videos/mainMenu.mp4');
|
||||||
|
|
||||||
|
// Music
|
||||||
|
this.load.audio('menuMusic', 'assets/music/menuMusic.mp3');
|
||||||
|
}
|
||||||
|
|
||||||
|
create() {
|
||||||
|
// Add typing text
|
||||||
|
const fullText = "Yet Another AAA Fertig Game....";
|
||||||
|
const typingText = new TypingText(this,
|
||||||
|
this.game.config.width / 2,
|
||||||
|
this.game.config.height / 2,
|
||||||
|
fullText,
|
||||||
|
{
|
||||||
|
fontFamily: 'eraserDust, Arial',
|
||||||
|
fontSize: '32px',
|
||||||
|
color: '#ffffff',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Start typing animation
|
||||||
|
this.time.delayedCall(1000, () => {
|
||||||
|
typingText.startTyping();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Maun Menu
|
||||||
|
this.time.delayedCall(7300, () => {
|
||||||
|
// Play mainMenu video on loop and stretch to fill background
|
||||||
|
this.mainMenuVideo = this.add.video(0, 0, 'mainMenu');
|
||||||
|
this.mainMenuVideo.setOrigin(0);
|
||||||
|
this.mainMenuVideo.scaleX = this.scale.width / 1280;
|
||||||
|
this.mainMenuVideo.scaleY = this.scale.height / 720;
|
||||||
|
this.mainMenuVideo.play(true);
|
||||||
|
const logo = this.physics.add.image(610, 225, 'logo').setScale(0).setOrigin(0.5);
|
||||||
|
this.tweens.add({
|
||||||
|
targets: logo,
|
||||||
|
angle: 360,
|
||||||
|
scale: .65,
|
||||||
|
duration: 3500,
|
||||||
|
ease: 'Bounce',
|
||||||
|
onComplete: () => {
|
||||||
|
this.tweens.add({
|
||||||
|
targets: logo,
|
||||||
|
scale: .7,
|
||||||
|
y: 250,
|
||||||
|
yoyo: true,
|
||||||
|
repeat: -1,
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
const typingText2 = new TypingText(this,
|
||||||
|
this.game.config.width / 2,
|
||||||
|
this.game.config.height / 2 + 150,
|
||||||
|
"Use Mouse to Control your Character",
|
||||||
|
{
|
||||||
|
fontFamily: 'eraserDust, Arial',
|
||||||
|
fontSize: '32px',
|
||||||
|
color: '#ffffff',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
typingText2.startTyping();
|
||||||
|
const typingText3 = new TypingText(this,
|
||||||
|
this.game.config.width / 2,
|
||||||
|
this.game.config.height / 2 + 200,
|
||||||
|
"Click Here to Start",
|
||||||
|
{
|
||||||
|
fontFamily: 'eraserDust, Arial',
|
||||||
|
fontSize: '32px',
|
||||||
|
color: '#ffffff',
|
||||||
|
align: 'center'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
typingText3.startTyping();
|
||||||
|
|
||||||
|
// Add click handler to start game
|
||||||
|
typingText3.typingText.setInteractive({ useHandCursor: true });
|
||||||
|
typingText3.typingText.on('pointerdown', () => {
|
||||||
|
// Stop video and music
|
||||||
|
if (this.mainMenuVideo) {
|
||||||
|
this.mainMenuVideo.stop();
|
||||||
|
}
|
||||||
|
if (this.bgMusic) {
|
||||||
|
this.bgMusic.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start Game scene
|
||||||
|
this.scene.start('Game');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Background Music
|
||||||
|
this.bgMusic = this.sound.add('menuMusic', { volume: 0.5 });
|
||||||
|
this.bgMusic.loop = true;
|
||||||
|
this.bgMusic.play();
|
||||||
|
}
|
||||||
|
|
||||||
|
update(time, delta) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Typing text class implementation
|
||||||
|
class TypingText {
|
||||||
|
constructor(scene, x, y, text, style = {}) {
|
||||||
|
this.scene = scene;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.text = text;
|
||||||
|
this.style = style;
|
||||||
|
this.fullText = text;
|
||||||
|
|
||||||
|
// Create empty text object
|
||||||
|
this.typingText = scene.add.text(x, y, '', style).setShadow(3,3, '#333', 5);
|
||||||
|
this.typingText.setOrigin(0.5);
|
||||||
|
|
||||||
|
// Animation properties
|
||||||
|
this.currentCharIndex = 0;
|
||||||
|
this.isTyping = false;
|
||||||
|
this.typingDelay = 100; // milliseconds per character
|
||||||
|
}
|
||||||
|
|
||||||
|
startTyping() {
|
||||||
|
if (this.isTyping) return;
|
||||||
|
|
||||||
|
this.isTyping = true;
|
||||||
|
this.currentCharIndex = 0;
|
||||||
|
|
||||||
|
// Clear existing text and start typing animation
|
||||||
|
this.typingText.setText('');
|
||||||
|
|
||||||
|
const typeCharacter = () => {
|
||||||
|
if (this.currentCharIndex < this.fullText.length) {
|
||||||
|
this.typingText.text += this.fullText.charAt(this.currentCharIndex);
|
||||||
|
this.currentCharIndex++;
|
||||||
|
|
||||||
|
// Schedule next character
|
||||||
|
setTimeout(typeCharacter, this.typingDelay);
|
||||||
|
} else {
|
||||||
|
this.isTyping = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typeCharacter();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue