Commit dd51bf73 by Иван Кубота

tree

parent 4887f606
......@@ -9,7 +9,7 @@
"url": "https://ldtk.io"
},
"jsonVersion": "0.9.3",
"nextUid": 178,
"nextUid": 182,
"worldLayout": "Free",
"worldGridWidth": 128,
"worldGridHeight": 128,
......@@ -759,6 +759,25 @@
"tilePivotY": 0
},
{
"__type": "Entities",
"identifier": "Tree",
"type": "Entities",
"uid": 179,
"gridSize": 8,
"displayOpacity": 1,
"pxOffsetX": 0,
"pxOffsetY": 0,
"requiredTags": [],
"excludedTags": [],
"intGridValues": [{ "value": 1, "identifier": null, "color": "#000000" }],
"autoTilesetDefUid": null,
"autoRuleGroups": [],
"autoSourceLayerDefUid": null,
"tilesetDefUid": null,
"tilePivotX": 0,
"tilePivotY": 0
},
{
"__type": "IntGrid",
"identifier": "Background",
"type": "IntGrid",
......@@ -1294,6 +1313,52 @@
"textLanguageMode": null
}
]
},
{
"identifier": "Tree",
"uid": 180,
"tags": [],
"width": 64,
"height": 94,
"resizableX": false,
"resizableY": true,
"keepAspectRatio": false,
"fillOpacity": 1,
"lineOpacity": 1,
"hollow": false,
"color": "#94D9B3",
"renderMode": "Tile",
"showName": true,
"tilesetId": 151,
"tileId": 2,
"tileRenderMode": "FitInside",
"maxCount": 0,
"limitScope": "PerLevel",
"limitBehavior": "MoveLastOne",
"pivotX": 0,
"pivotY": 0,
"fieldDefs": [
{
"identifier": "Layer",
"__type": "LocalEnum.Layer",
"uid": 181,
"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
}
]
}
], "tilesets": [
{
......@@ -1392,7 +1457,11 @@
"averageColors": "09d507c409d47684f674f67376742dd22cc20000000015a514960000000000000884f674f6747643f643f74377434dd24cc2000086b5e6b5e5a59496000000000753f643f643177359b46ab408530000000036b5e6b5f6a4c6a57495000000000693c774c67408d449b449c4039654968496349635a5b56386a406b4000000000643f743f743000008a9379855a5f7b5f6b5b496038675420000000000000000074347434743000037a817a935a6e6a5e6a5a495038685320000000000000000000036b507b40878477415870000138685640386000055320000000000000000000026b526b506b3566427750db300005532000000000000000000000000000006b436b527b506b319b4558305a50000753200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
}
], "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] } ], "iconTilesetUid": 9, "externalRelPath": null, "externalFileChecksum": null }], "externalEnums": [], "levelFields": [
], "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": [
{
"identifier": "tutorial",
"__type": "String",
......@@ -1543,10 +1612,7 @@
"autoLayerTiles": [],
"seed": 3739032,
"overrideTilesetUid": null,
"gridTiles": [
{ "px": [176,0], "src": [316,20], "f": 0, "t": 2, "d": [22] },
{ "px": [184,112], "src": [316,168], "f": 0, "t": 6, "d": [541] }
],
"gridTiles": [],
"entityInstances": []
},
{
......@@ -1647,25 +1713,14 @@
]
},
{
"__identifier": "CircleRegion",
"__grid": [27,9],
"__pivot": [0.5,0.5],
"__tile": null,
"width": 88,
"height": 88,
"defUid": 125,
"px": [220,76],
"fieldInstances": []
},
{
"__identifier": "Entity",
"__grid": [7,17],
"__grid": [5,18],
"__pivot": [0,0],
"__tile": { "tilesetUid": 9, "srcRect": [40,40,8,8] },
"width": 16,
"height": 16,
"defUid": 126,
"px": [56,136],
"px": [40,144],
"fieldInstances": [{
"__identifier": "Waypoints",
"__value": [
......@@ -2082,6 +2137,51 @@
"entityInstances": []
},
{
"__identifier": "Tree",
"__type": "Entities",
"__cWid": 37,
"__cHei": 22,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"levelId": 70,
"layerDefUid": 179,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 7025345,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": [
{
"__identifier": "Tree",
"__grid": [25,1],
"__pivot": [0,0],
"__tile": { "tilesetUid": 151, "srcRect": [316,20,128,128] },
"width": 64,
"height": 94,
"defUid": 180,
"px": [203,14],
"fieldInstances": [{
"__identifier": "Layer",
"__value": "Tree",
"__type": "LocalEnum.Layer",
"defUid": 181,
"realEditorValues": [{
"id": "V_String",
"params": ["Tree"]
}]
}]
}
]
},
{
"__identifier": "Background",
"__type": "IntGrid",
"__cWid": 37,
......@@ -2462,6 +2562,30 @@
"entityInstances": []
},
{
"__identifier": "Tree",
"__type": "Entities",
"__cWid": 25,
"__cHei": 15,
"__gridSize": 8,
"__opacity": 1,
"__pxTotalOffsetX": 0,
"__pxTotalOffsetY": 0,
"__tilesetDefUid": null,
"__tilesetRelPath": null,
"levelId": 171,
"layerDefUid": 179,
"pxOffsetX": 0,
"pxOffsetY": 0,
"visible": true,
"optionalRules": [],
"intGridCsv": [],
"autoLayerTiles": [],
"seed": 943423,
"overrideTilesetUid": null,
"gridTiles": [],
"entityInstances": []
},
{
"__identifier": "Background",
"__type": "IntGrid",
"__cWid": 25,
......
......@@ -6,7 +6,8 @@ Game({
Zone,
Player,
Key,
NPC
NPC,
Tree
},
loaded: function() {
......
......@@ -297,12 +297,14 @@ var physic = function(level, dt, tfs) {
for( var i = 0, _i = entities.length; i < _i; i++ ){
var entity = entities[ i ];
entity.step && entity.step(dt, tfs);
for(var a = entity.animations.length-1; a>=0; a--){
var animation = entity.animations[a],
percent = Math.max(0, Math.min(1, (t/1000-(animation.start+animation.wait))/animation.duration));
animation.fn.call(entity, percent);
if(percent === 1){
entity.animations.splice(a, 1);
if(entity.animations){
for( var a = entity.animations.length - 1; a >= 0; a-- ){
var animation = entity.animations[ a ],
percent = Math.max( 0, Math.min( 1, ( t / 1000 - ( animation.start + animation.wait ) ) / animation.duration ) );
animation.fn.call( entity, percent );
if( percent === 1 ){
entity.animations.splice( a, 1 );
}
}
}
}
......
......@@ -23,6 +23,7 @@
<script src="object/Key.js"></script>
<script src="object/NPC.js"></script>
<script src="object/Zone.js"></script>
<script src="object/Tree.js"></script>
<script src="js/main.js"></script>
</body>
......
class Key extends GameObject {
step(dt, tfs){
if(this.collide(Player)){
var hole = this.getItem( Zone, { Name: 'Hole' } );
this.startTime = tfs;
hole.animate( 'hideWall', function( progress ){
......
......@@ -35,7 +35,6 @@ class NPC extends GameObject {
}, 2 );
}
}
//this.position[1]+=1;
}
draw(dt, tfs){
this.render();
......
class Tree extends GameObject {
init(){
this.extendSprite();
}
}
\ 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