first commit

This commit is contained in:
Brian Fertig 2025-08-16 18:16:52 -06:00
commit 13abba7061
13 changed files with 824 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
name: Phaser 3.90 Framework
---
- Follow best practices for Phaser 3.90
- Follow best ES6 practices
- Write class imports using full .js paths, NPM package manager or any other web packager is not installed
- Break things out into classes when it makes sense

317
assets/game-map.json Normal file
View File

@ -0,0 +1,317 @@
{ "compressionlevel":-1,
"height":40,
"infinite":true,
"layers":[
{
"chunks":[
{
"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, 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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, 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, 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 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",
"tileheight":100,
"tilesets":[
{
"columns":10,
"firstgid":1,
"image":"images\/terrain.png",
"imageheight":1000,
"imagewidth":1000,
"margin":0,
"name":"terrain",
"spacing":0,
"tilecount":100,
"tileheight":100,
"tiles":[
{
"id":0,
"properties":[
{
"name":"collides",
"type":"bool",
"value":true
}]
}],
"tilewidth":100
}],
"tilewidth":100,
"type":"map",
"version":"1.10",
"width":60
}

BIN
assets/images/player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

BIN
assets/images/terrain.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

29
index.html Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fablewood - Survival Crafting Game</title>
<style>
body {
margin: 0;
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>
</head>
<body>
<div id="game-container"></div>
<script src="src/phaser.min.js"></script>
<script type="module" src="src/main.js"></script>
</body>
</html>

BIN
raw/Player.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 KiB

234
raw/game-map.tmx Normal file
View File

@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="60" height="40" tilewidth="100" tileheight="100" infinite="1" nextlayerid="2" nextobjectid="1">
<editorsettings>
<export target="../assets/game-map.json" format="json"/>
</editorsettings>
<tileset firstgid="1" name="terrain" tilewidth="100" tileheight="100" tilecount="100" columns="10">
<image source="../assets/images/terrain.png" width="1000" height="1000"/>
<tile id="0">
<properties>
<property name="collides" type="bool" value="true"/>
</properties>
</tile>
</tileset>
<layer id="1" name="main" width="60" height="40">
<data encoding="csv">
<chunk x="0" y="0" width="16" height="16">
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,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
</chunk>
<chunk x="16" y="0" width="16" height="16">
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
</chunk>
<chunk x="32" y="0" width="16" height="16">
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
</chunk>
<chunk x="48" y="0" width="16" height="16">
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
</chunk>
<chunk x="0" y="16" width="16" height="16">
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
</chunk>
<chunk x="16" y="16" width="16" height="16">
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
</chunk>
<chunk x="32" y="16" width="16" height="16">
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
</chunk>
<chunk x="48" y="16" width="16" height="16">
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,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,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</chunk>
</data>
</layer>
</map>

BIN
raw/player.psd Normal file

Binary file not shown.

29
src/main.js Normal file
View File

@ -0,0 +1,29 @@
import { Game } from './scenes/Game.js';
const config = {
type: Phaser.AUTO,
scale: {
mode: Phaser.Scale.RESIZE,
width: 1280,
height: 720,
},
physics: {
default: 'arcade',
arcade: {
gravity: { y: 0 },
debug: false
}
},
backgroundColor: '#000000',
scene: [
// MenuScene,
// Intro,
// Tutorial,
Game
]
};
const game = new Phaser.Game(config);
//game.globalState = new GlobalState();

1
src/phaser.min.js vendored Normal file

File diff suppressed because one or more lines are too long

151
src/player.js Normal file
View File

@ -0,0 +1,151 @@
export class Player extends Phaser.GameObjects.Sprite {
constructor(scene, x, y) {
super(scene, x, y, 'player');
// Add to scene
scene.add.existing(this);
scene.physics.world.enable(this);
this.body.setCollideWorldBounds(true);
// Set player properties
this.speed = 200;
this.isMoving = false;
this.targetX = x;
this.targetY = y;
// Add input listener for mouse clicks
scene.input.on('pointerdown', (pointer) => {
console.log(pointer);
this.moveToPoint(pointer.worldX, pointer.worldY);
});
// Create animations
this.anims.create({
key: 'player-up',
frames: this.anims.generateFrameNumbers('player', { start: 10, end: 15 }),
frameRate: 10,
repeat: -1
});
this.anims.create({
key: 'player-side',
frames: this.anims.generateFrameNumbers('player', { start: 0, end: 5 }),
frameRate: 10,
repeat: -1
});
this.anims.create({
key: 'player-down',
frames: this.anims.generateFrameNumbers('player', { start: 20, end: 25 }),
frameRate: 10,
repeat: -1
});
this.anims.create({
key: 'player-idle',
frames: [
{ key: 'player', frame: 30 }
],
frameRate: 5,
repeat: -1
});
// Set initial animation
this.anims.play('player-idle');
}
moveToPoint(x, y) {
// Set target position
this.targetX = x;
this.targetY = y;
// Calculate direction to target
const dx = x - this.x;
const dy = y - this.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 100) { // Only move if target is far enough
this.isMoving = true;
// Set velocity towards target
const speedRatio = this.speed / distance;
this.body.setVelocityX(dx * speedRatio);
this.body.setVelocityY(dy * speedRatio);
}
}
update() {
// Check if player has reached target
if (this.isMoving) {
const dx = this.targetX - this.x;
const dy = this.targetY - this.y;
const distance = Math.sqrt(dx * dx + dy * dy);
// Stop when close enough to target
if (distance < 10) {
this.body.setVelocity(0, 0);
this.isMoving = false;
// Play idle animation when stopping
this.anims.play('player-idle');
} else {
// Update animation based on movement direction
this.updateAnimation();
}
} else {
// If not moving and velocity is zero, play idle
if (this.body && this.body.velocity.x === 0 && this.body.velocity.y === 0) {
this.anims.play('player-idle');
}
}
}
updateAnimation() {
// Get current velocity
const velX = this.body.velocity.x;
const velY = this.body.velocity.y;
// Calculate magnitude of velocity
const speed = Math.sqrt(velX * velX + velY * velY);
if (speed < 5) { // If moving very slowly, play idle
this.anims.play('player-idle');
return;
}
// Determine dominant direction based on velocity components
const absVelX = Math.abs(velX);
const absVelY = Math.abs(velY);
if (absVelY > absVelX) {
// Moving mostly vertically
if (velY < 0) {
// Moving up
this.anims.play('player-up', true);
} else {
// Moving down
this.anims.play('player-down', true);
}
} else {
// Moving mostly horizontally
if (velX < 0) {
// Moving left - use side animation with flipX = true
this.anims.play('player-side', true);
this.setFlipX(false);
} else {
// Moving right - use side animation with flipX = false
this.anims.play('player-side', true);
this.setFlipX(true);
}
}
}
// Method to stop player movement
stop() {
this.setVelocity(0, 0);
this.isMoving = false;
// Play idle animation when stopping
this.anims.play('player-idle');
}
}

54
src/scenes/Game.js Normal file
View File

@ -0,0 +1,54 @@
import { Player } from '../player.js';
export class Game extends Phaser.Scene {
constructor() {
super({ key: 'Game' });
}
preload() {
// Load player sprite
this.load.spritesheet('player', 'assets/images/player.png', {
frameWidth: 100,
frameHeight: 100
});
// Load tilemap
this.load.tilemapTiledJSON('game-map', 'assets/game-map.json');
// Load tileset image
this.load.image('terrain-tileset', 'assets/images/terrain.png');
}
create() {
// Create tilemap
const map = this.make.tilemap({ key: 'game-map' });
// Add tileset to map
const terrainTileset = map.addTilesetImage('terrain', 'terrain-tileset');
// Create layer named "main"
const mainLayer = map.createLayer('main', terrainTileset, 0, 0)
.setCollisionByProperty({ collides: true });
// Set world bounds based on tilemap dimensions
const worldWidth = map.widthInPixels;
const worldHeight = map.heightInPixels;
this.physics.world.setBounds(0, 0, worldWidth, worldHeight);
// Create player at center of screen
this.player = new Player(this, 1600, 3100);
// Physics Collisions
this.physics.add.collider(this.player, mainLayer);
// Make camera follow the player
this.cameras.main.startFollow(this.player);
this.cameras.main.setBounds(0, 0, worldWidth, worldHeight);
}
update() {
// Update player
if (this.player) {
this.player.update();
}
}
}

1
start_web.bat Normal file
View File

@ -0,0 +1 @@
python -m http.server 8000