Skip to content

Commit f1a7e29

Browse files
Flying KatsuFlying Katsu
Flying Katsu
authored and
Flying Katsu
committed
project structure updated according to #1 and #2
1 parent 7aef163 commit f1a7e29

File tree

58 files changed

+1824
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1824
-114
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Sup.ArcadePhysics2D.setGravity(0, -0.02);
2+
3+
class PlayerBehavior extends Sup.Behavior {
4+
speed = 0.2;
5+
jumpSpeed = 0.4;
6+
7+
update() {
8+
Sup.ArcadePhysics2D.collides(this.actor.arcadeBody2D, Sup.ArcadePhysics2D.getAllBodies());
9+
10+
// As explained above, we get the current velocity
11+
let velocity = this.actor.arcadeBody2D.getVelocity();
12+
13+
// We override the `.x` component based on the player's input
14+
if (Sup.Input.isKeyDown("LEFT") || Sup.Input.isKeyDown("A")) {
15+
velocity.x = -this.speed;
16+
// When going left, we flip the sprite
17+
this.actor.spriteRenderer.setHorizontalFlip(true);
18+
} else if (Sup.Input.isKeyDown("RIGHT") || Sup.Input.isKeyDown("D")) {
19+
velocity.x = this.speed;
20+
// When going right, we clear the flip
21+
this.actor.spriteRenderer.setHorizontalFlip(false);
22+
} else velocity.x = 0;
23+
24+
// If the player is on the ground and wants to jump,
25+
// we update the `.y` component accordingly
26+
let touchBottom = this.actor.arcadeBody2D.getTouches().bottom;
27+
if (touchBottom) {
28+
if (Sup.Input.wasKeyJustPressed("UP") || Sup.Input.isKeyDown("W") || Sup.Input.isKeyDown("SPACE")) {
29+
velocity.y = this.jumpSpeed;
30+
this.actor.spriteRenderer.setAnimation("Jump");
31+
} else {
32+
// Here, we should play either "Idle" or "Run" depending on the horizontal speed
33+
if (velocity.x === 0) this.actor.spriteRenderer.setAnimation("Idle");
34+
else this.actor.spriteRenderer.setAnimation("Move");
35+
}
36+
} else {
37+
// Here, we should play either "Jump" or "Fall" depending on the vertical speed
38+
if (velocity.y >= 0) this.actor.spriteRenderer.setAnimation("Jump");
39+
else this.actor.spriteRenderer.setAnimation("Fall");
40+
}
41+
42+
// Finally, we apply the velocity back to the ArcadePhysics body
43+
this.actor.arcadeBody2D.setVelocity(velocity);
44+
}
45+
}
46+
Sup.registerBehavior(PlayerBehavior);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": [
4+
{
5+
"id": "0",
6+
"name": "Player",
7+
"children": [],
8+
"components": [
9+
{
10+
"type": "SpriteRenderer",
11+
"config": {
12+
"formatVersion": 1,
13+
"spriteAssetId": "28",
14+
"animationId": "0",
15+
"horizontalFlip": false,
16+
"verticalFlip": false,
17+
"castShadow": false,
18+
"receiveShadow": false,
19+
"color": "ffffff",
20+
"overrideOpacity": false,
21+
"opacity": null,
22+
"materialType": "basic",
23+
"shaderAssetId": null
24+
},
25+
"id": "1"
26+
},
27+
{
28+
"type": "Behavior",
29+
"config": {
30+
"behaviorName": "PlayerBehavior",
31+
"propertyValues": {}
32+
},
33+
"id": "2"
34+
},
35+
{
36+
"type": "ArcadeBody2D",
37+
"config": {
38+
"formatVersion": 2,
39+
"type": "box",
40+
"movable": true,
41+
"width": 2,
42+
"height": 2,
43+
"offset": {
44+
"x": 0,
45+
"y": 0
46+
},
47+
"bounce": {
48+
"x": 0,
49+
"y": 0
50+
},
51+
"tileMapAssetId": null,
52+
"tileSetPropertyName": null,
53+
"layersIndex": null
54+
},
55+
"id": "3"
56+
}
57+
],
58+
"position": {
59+
"x": 0,
60+
"y": 0,
61+
"z": 0
62+
},
63+
"orientation": {
64+
"x": 0,
65+
"y": 0,
66+
"z": 0,
67+
"w": 1
68+
},
69+
"scale": {
70+
"x": 1,
71+
"y": 1,
72+
"z": 1
73+
},
74+
"visible": true,
75+
"layer": 0,
76+
"prefab": null
77+
}
78+
]
79+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class ChestBehavior extends Sup.Behavior {
2+
awake() {
3+
4+
}
5+
6+
update() {
7+
8+
}
9+
}
10+
Sup.registerBehavior(ChestBehavior);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class DirtBehavior extends Sup.Behavior {
2+
awake() {
3+
4+
}
5+
6+
update() {
7+
8+
}
9+
}
10+
Sup.registerBehavior(DirtBehavior);

assets/Keep (129)/Entities (134)/Interactive (15)/Dirt (167)/DirtSprite (169)/map-map.dat

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"formatVersion": 3,
3+
"maps": [
4+
"map"
5+
],
6+
"filtering": "pixelated",
7+
"wrapping": "clampToEdge",
8+
"pixelsPerUnit": 32,
9+
"framesPerSecond": 10,
10+
"opacity": null,
11+
"alphaTest": 0.1,
12+
"frameOrder": "rows",
13+
"grid": {
14+
"width": 100,
15+
"height": 100
16+
},
17+
"origin": {
18+
"x": 0.5,
19+
"y": 0.5
20+
},
21+
"animations": [],
22+
"mapSlots": {
23+
"map": "map",
24+
"light": null,
25+
"specular": null,
26+
"alpha": null,
27+
"normal": null
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class FruitSpawnerBehavior extends Sup.Behavior {
2+
awake() {
3+
4+
}
5+
6+
update() {
7+
8+
}
9+
}
10+
Sup.registerBehavior(FruitSpawnerBehavior);

assets/Keep (129)/Entities (134)/Interactive (15)/FruitSpawner (171)/FruitSpawnerSprite (174)/map-map.dat

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"formatVersion": 3,
3+
"maps": [
4+
"map"
5+
],
6+
"filtering": "pixelated",
7+
"wrapping": "clampToEdge",
8+
"pixelsPerUnit": 32,
9+
"framesPerSecond": 10,
10+
"opacity": null,
11+
"alphaTest": 0.1,
12+
"frameOrder": "rows",
13+
"grid": {
14+
"width": 100,
15+
"height": 100
16+
},
17+
"origin": {
18+
"x": 0.5,
19+
"y": 0.5
20+
},
21+
"animations": [],
22+
"mapSlots": {
23+
"map": "map",
24+
"light": null,
25+
"specular": null,
26+
"alpha": null,
27+
"normal": null
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}

assets/Keep (129)/Entities (134)/Items (12)/Interest (15)/Treasure (41)/TreasureBehavior (39)/script.ts

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": []
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"formatVersion": 1,
3+
"nodes": [
4+
{
5+
"id": "0",
6+
"name": "Map",
7+
"children": [],
8+
"components": [
9+
{
10+
"type": "TileMapRenderer",
11+
"config": {
12+
"formatVersion": 1,
13+
"tileMapAssetId": "147",
14+
"tileSetAssetId": null,
15+
"castShadow": false,
16+
"receiveShadow": false,
17+
"materialType": "basic",
18+
"shaderAssetId": null
19+
},
20+
"id": "0"
21+
},
22+
{
23+
"type": "ArcadeBody2D",
24+
"config": {
25+
"formatVersion": 2,
26+
"type": "tileMap",
27+
"movable": true,
28+
"width": 1,
29+
"height": 1,
30+
"offset": {
31+
"x": 0,
32+
"y": 0
33+
},
34+
"bounce": {
35+
"x": 0,
36+
"y": 0
37+
},
38+
"tileMapAssetId": "147",
39+
"tileSetPropertyName": "solid",
40+
"layersIndex": "0"
41+
},
42+
"id": "1"
43+
}
44+
],
45+
"position": {
46+
"x": 0,
47+
"y": 0,
48+
"z": 0
49+
},
50+
"orientation": {
51+
"x": 0,
52+
"y": 0,
53+
"z": 0,
54+
"w": 1
55+
},
56+
"scale": {
57+
"x": 1,
58+
"y": 1,
59+
"z": 1
60+
},
61+
"visible": true,
62+
"layer": 0,
63+
"prefab": null
64+
}
65+
]
66+
}

assets/Keep (129)/Map (144)/Tile Map (147)/tilemap.json

+1
Large diffs are not rendered by default.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"formatVersion": 1,
3+
"grid": {
4+
"width": 16,
5+
"height": 16
6+
},
7+
"tileProperties": {
8+
"0_0": {
9+
"solid": ""
10+
},
11+
"3_0": {
12+
"fruitspawner": ""
13+
},
14+
"1_0": {
15+
"treasure": ""
16+
},
17+
"2_0": {
18+
"treetrunk": ""
19+
},
20+
"4_0": {
21+
"dirt": ""
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)