Commit e90f7b86 by Sanya

zhaba, trash, some fixes

parent e698e082
......@@ -9,7 +9,7 @@
"url": "https://ldtk.io"
},
"jsonVersion": "0.9.3",
"nextUid": 184,
"nextUid": 190,
"worldLayout": "Free",
"worldGridWidth": 128,
"worldGridHeight": 128,
......@@ -1339,6 +1339,72 @@
"textLanguageMode": null
}
]
},
{
"identifier": "Trash",
"uid": 185,
"tags": [],
"width": 8,
"height": 8,
"resizableX": false,
"resizableY": false,
"keepAspectRatio": false,
"fillOpacity": 1,
"lineOpacity": 1,
"hollow": false,
"color": "#94D9B3",
"renderMode": "Tile",
"showName": true,
"tilesetId": 187,
"tileId": 0,
"tileRenderMode": "FitInside",
"maxCount": 0,
"limitScope": "PerLevel",
"limitBehavior": "MoveLastOne",
"pivotX": 0,
"pivotY": 0,
"fieldDefs": [
{
"identifier": "Layer",
"__type": "LocalEnum.Layer",
"uid": 186,
"type": { "id": "F_Enum", "params": [141] },
"isArray": false,
"canBeNull": false,
"arrayMinLength": null,
"arrayMaxLength": null,
"editorDisplayMode": "Hidden",
"editorDisplayPos": "Above",
"editorAlwaysShow": false,
"editorCutLongValues": true,
"min": null,
"max": null,
"regex": null,
"acceptFileTypes": null,
"defaultOverride": null,
"textLanguageMode": null
},
{
"identifier": "TrashType",
"__type": "LocalEnum.TrashType",
"uid": 189,
"type": { "id": "F_Enum", "params": [188] },
"isArray": false,
"canBeNull": false,
"arrayMinLength": null,
"arrayMaxLength": null,
"editorDisplayMode": "EntityTile",
"editorDisplayPos": "Above",
"editorAlwaysShow": false,
"editorCutLongValues": true,
"min": null,
"max": null,
"regex": null,
"acceptFileTypes": null,
"defaultOverride": null,
"textLanguageMode": null
}
]
}
], "tilesets": [
{
......@@ -1438,12 +1504,29 @@
}
},
{
"__cWid": 3,
"__cWid": 4,
"__cHei": 1,
"identifier": "Jaba12",
"uid": 182,
"relPath": "sprites/Jaba1.png",
"pxWid": 192,
"pxWid": 256,
"pxHei": 64,
"tileGridSize": 64,
"spacing": 0,
"padding": 0,
"tagsSourceEnumUid": null,
"enumTags": [],
"customData": [],
"savedSelections": [],
"cachedPixelData": { "opaqueTiles": "0000", "averageColors": "1573157215721572" }
},
{
"__cWid": 1,
"__cHei": 1,
"identifier": "Bbbbbeaaaans",
"uid": 184,
"relPath": "sprites/bbbbbeaaaans.png",
"pxWid": 64,
"pxHei": 64,
"tileGridSize": 64,
"spacing": 0,
......@@ -1452,13 +1535,37 @@
"enumTags": [],
"customData": [],
"savedSelections": [],
"cachedPixelData": { "opaqueTiles": "000", "averageColors": "157315721572" }
"cachedPixelData": { "opaqueTiles": "0", "averageColors": "2775" }
},
{
"__cWid": 3,
"__cHei": 3,
"identifier": "BBBBBeeeAn",
"uid": 187,
"relPath": "sprites/BBBBBeeeAn.png",
"pxWid": 192,
"pxHei": 192,
"tileGridSize": 64,
"spacing": 0,
"padding": 0,
"tagsSourceEnumUid": 188,
"enumTags": [ { "enumValueId": "TinCan1", "tileIds": [0] }, { "enumValueId": "TinCan2", "tileIds": [1] }, { "enumValueId": "TinCan3", "tileIds": [3] } ],
"customData": [],
"savedSelections": [],
"cachedPixelData": { "opaqueTiles": "000000000", "averageColors": "2775357800002a4300000000000000000000" }
}
], "enums": [{ "identifier": "Layer", "uid": 141, "values": [
], "enums": [
{ "identifier": "Layer", "uid": 141, "values": [
{ "id": "Level", "tileId": 78, "color": 8019781, "__tileSrcRect": [48,48,8,8] },
{ "id": "Patches", "tileId": 44, "color": 2896729, "__tileSrcRect": [64,24,8,8] },
{ "id": "Tree", "tileId": 12, "color": 5993018, "__tileSrcRect": [0,8,8,8] }
], "iconTilesetUid": 9, "externalRelPath": null, "externalFileChecksum": null }], "externalEnums": [], "levelFields": [
], "iconTilesetUid": 9, "externalRelPath": null, "externalFileChecksum": null },
{ "identifier": "TrashType", "uid": 188, "values": [
{ "id": "TinCan1", "tileId": 0, "color": 7632476, "__tileSrcRect": [0,0,64,64] },
{ "id": "TinCan2", "tileId": 1, "color": 6123652, "__tileSrcRect": [64,0,64,64] },
{ "id": "TinCan3", "tileId": 3, "color": 10766899, "__tileSrcRect": [0,64,64,64] }
], "iconTilesetUid": 187, "externalRelPath": null, "externalFileChecksum": null }
], "externalEnums": [], "levelFields": [
{
"identifier": "tutorial",
"__type": "String",
......@@ -1703,13 +1810,13 @@
},
{
"__identifier": "Player",
"__grid": [17,6],
"__grid": [7,9],
"__pivot": [0,0],
"__tile": { "tilesetUid": 143, "srcRect": [64,0,32,32] },
"width": 16,
"height": 32,
"defUid": 144,
"px": [136,48],
"px": [56,72],
"fieldInstances": [{
"__identifier": "Layer",
"__value": "Level",
......@@ -1862,6 +1969,102 @@
}]
}
]
},
{
"__identifier": "Trash",
"__grid": [6,11],
"__pivot": [0,0],
"__tile": { "tilesetUid": 187, "srcRect": [64,0,64,64] },
"width": 8,
"height": 8,
"defUid": 185,
"px": [48,92],
"fieldInstances": [
{
"__identifier": "Layer",
"__value": "Level",
"__type": "LocalEnum.Layer",
"defUid": 186,
"realEditorValues": [{
"id": "V_String",
"params": ["Level"]
}]
},
{
"__identifier": "TrashType",
"__value": "TinCan2",
"__type": "LocalEnum.TrashType",
"defUid": 189,
"realEditorValues": [{
"id": "V_String",
"params": ["TinCan2"]
}]
}
]
},
{
"__identifier": "Trash",
"__grid": [10,11],
"__pivot": [0,0],
"__tile": { "tilesetUid": 187, "srcRect": [0,0,64,64] },
"width": 8,
"height": 8,
"defUid": 185,
"px": [80,91],
"fieldInstances": [
{
"__identifier": "Layer",
"__value": "Level",
"__type": "LocalEnum.Layer",
"defUid": 186,
"realEditorValues": [{
"id": "V_String",
"params": ["Level"]
}]
},
{
"__identifier": "TrashType",
"__value": "TinCan1",
"__type": "LocalEnum.TrashType",
"defUid": 189,
"realEditorValues": [{
"id": "V_String",
"params": ["TinCan1"]
}]
}
]
},
{
"__identifier": "Trash",
"__grid": [15,9],
"__pivot": [0,0],
"__tile": { "tilesetUid": 187, "srcRect": [0,64,64,64] },
"width": 8,
"height": 8,
"defUid": 185,
"px": [120,74],
"fieldInstances": [
{
"__identifier": "Layer",
"__value": "Level",
"__type": "LocalEnum.Layer",
"defUid": 186,
"realEditorValues": [{
"id": "V_String",
"params": ["Level"]
}]
},
{
"__identifier": "TrashType",
"__value": "TinCan3",
"__type": "LocalEnum.TrashType",
"defUid": 189,
"realEditorValues": [{
"id": "V_String",
"params": ["TinCan3"]
}]
}
]
}
]
},
......@@ -2187,6 +2390,7 @@
{ "px": [320,8], "src": [32,40], "f": 0, "t": 64, "d": [95,81] },
{ "px": [184,16], "src": [32,40], "f": 0, "t": 64, "d": [95,105] },
{ "px": [192,16], "src": [32,40], "f": 0, "t": 64, "d": [95,106] },
{ "px": [104,48], "src": [32,40], "f": 0, "t": 64, "d": [95,259] },
{ "px": [112,48], "src": [32,40], "f": 0, "t": 64, "d": [95,260] },
{ "px": [120,48], "src": [32,40], "f": 0, "t": 64, "d": [95,261] },
{ "px": [168,48], "src": [32,40], "f": 0, "t": 64, "d": [95,267] },
......@@ -2196,11 +2400,16 @@
{ "px": [0,72], "src": [32,40], "f": 0, "t": 64, "d": [95,369] },
{ "px": [32,72], "src": [32,40], "f": 0, "t": 64, "d": [95,373] },
{ "px": [128,72], "src": [32,40], "f": 0, "t": 64, "d": [95,385] },
{ "px": [192,72], "src": [32,40], "f": 0, "t": 64, "d": [95,393] },
{ "px": [8,80], "src": [32,40], "f": 0, "t": 64, "d": [95,411] },
{ "px": [104,80], "src": [32,40], "f": 0, "t": 64, "d": [95,423] },
{ "px": [168,80], "src": [32,40], "f": 0, "t": 64, "d": [95,431] },
{ "px": [88,88], "src": [32,40], "f": 0, "t": 64, "d": [95,462] },
{ "px": [96,88], "src": [32,40], "f": 0, "t": 64, "d": [95,463] },
{ "px": [224,88], "src": [32,40], "f": 0, "t": 64, "d": [95,479] },
{ "px": [168,96], "src": [32,40], "f": 0, "t": 64, "d": [95,513] },
{ "px": [184,96], "src": [32,40], "f": 0, "t": 64, "d": [95,515] },
{ "px": [192,96], "src": [32,40], "f": 0, "t": 64, "d": [95,516] },
{ "px": [256,96], "src": [32,40], "f": 0, "t": 64, "d": [95,524] },
{ "px": [272,96], "src": [32,40], "f": 0, "t": 64, "d": [95,526] },
{ "px": [160,104], "src": [32,40], "f": 0, "t": 64, "d": [95,553] },
......
......@@ -7,7 +7,8 @@ Game({
Player,
Key,
NPC,
Tree
Tree,
Trash
},
loaded: function() {
......
......@@ -575,6 +575,8 @@ GameObject.prototype = {
}
return true;
})[0]
}else{
return its[0];
}
},
loadAnimation: function(animationName, {manual, duration, path, size, frames, offset, padding}) {
......
......@@ -24,6 +24,7 @@
<script src="object/NPC.js"></script>
<script src="object/Zone.js"></script>
<script src="object/Tree.js"></script>
<script src="object/Trash.js"></script>
<script src="js/main.js"></script>
</body>
......
// Класс игрока
class Player extends GameObject {
init(){
this.tinCans = 0;
this.extendSprite();
this.position[1]++;
this.collisionOffset = [5,8,5,9];
......
// Зона вырезает кусок слоя уровня и даёт возможность показывать и скрывать выбранные участки геометрии уровня
class Trash extends GameObject {
init() {
}
step(dt, tfs){
if(this.collide(Player) && this.visible){
this.getItem( Player ).tinCans += 1;
console.log('Tin cans = ', this.getItem( Player ).tinCans )
this.visible = false;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment