Changes:
- use toggle tile for all toggling entities (transient, switch, door) - get rod of hard coded sprites (exception: particle class, to be fixed later) - changed switch sprite (rect instead of elipse)
This commit is contained in:
parent
f6f2172f11
commit
faf0fd99c2
@ -1,18 +0,0 @@
|
|||||||
Description: open the door
|
|
||||||
MinMoves: 2
|
|
||||||
Background: background-lila
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#######
|
|
||||||
#o #
|
|
||||||
# t #
|
|
||||||
#> S <#
|
|
||||||
# #
|
|
||||||
# ^ #
|
|
||||||
#######
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
Description: test obstacles
|
|
||||||
MinMoves: 14
|
|
||||||
Background: background-lila
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#############
|
|
||||||
# t #
|
|
||||||
#> S # #
|
|
||||||
# ># ^#
|
|
||||||
#< #W#####
|
|
||||||
# o v# o#
|
|
||||||
#############
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
Description: collect all yellow dots
|
|
||||||
MinMoves: 7
|
|
||||||
Background: background-lila
|
|
||||||
|
|
||||||
|
|
||||||
# ############
|
|
||||||
# #
|
|
||||||
############ #
|
|
||||||
# o S #
|
|
||||||
# ######## ###
|
|
||||||
+ #
|
|
||||||
############ #
|
|
||||||
# o # #
|
|
||||||
# # ######## #
|
|
||||||
# # o
|
|
||||||
# ############
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
Description: some enemies can be moved
|
|
||||||
MinMoves: 5
|
|
||||||
Background: background-lila
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########
|
|
||||||
# o <o#
|
|
||||||
#v S # #
|
|
||||||
# #### #
|
|
||||||
|
|
||||||
|
|
||||||
# #### #
|
|
||||||
# #
|
|
||||||
# ^#
|
|
||||||
########
|
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
Description: the more players the better
|
|
||||||
MinMoves: 4
|
|
||||||
Background: background-lila
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
########W#
|
|
||||||
# v#
|
|
||||||
# #
|
|
||||||
#S s#
|
|
||||||
############
|
|
||||||
# o #
|
|
||||||
######## #
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
Description: don't fall off the world
|
|
||||||
MinMoves: 3
|
|
||||||
Background: background-lila
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
W
|
|
||||||
|
|
||||||
|
|
||||||
S # o
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
o
|
|
||||||
#
|
|
||||||
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
width=$(grep "width " ../../main.go | awk '{print $4}')
|
|
||||||
height=$(grep "height " ../../main.go | awk '{print $4}')
|
|
||||||
|
|
||||||
read -p " Enter level name: " name
|
|
||||||
read -p " Enter background: " background
|
|
||||||
read -p "Enter description: " des
|
|
||||||
|
|
||||||
if test -z "$name"; then
|
|
||||||
name="newlevel"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$bbackground"; then
|
|
||||||
background="background-lila"
|
|
||||||
fi
|
|
||||||
|
|
||||||
w=$(($width/32))
|
|
||||||
h=$(($height/32))
|
|
||||||
|
|
||||||
(
|
|
||||||
echo "Description: $des"
|
|
||||||
echo "Background: $background"
|
|
||||||
|
|
||||||
for x in $(seq 1 $h); do
|
|
||||||
for y in $(seq 1 $w); do
|
|
||||||
echo -n " "
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
)
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"iid": "267e9380-d7b0-11ee-a97e-35bec9c19d52",
|
"iid": "267e9380-d7b0-11ee-a97e-35bec9c19d52",
|
||||||
"jsonVersion": "1.5.3",
|
"jsonVersion": "1.5.3",
|
||||||
"appBuildId": 473703,
|
"appBuildId": 473703,
|
||||||
"nextUid": 70,
|
"nextUid": 76,
|
||||||
"identifierStyle": "Capitalize",
|
"identifierStyle": "Capitalize",
|
||||||
"toc": [],
|
"toc": [],
|
||||||
"worldLayout": "Free",
|
"worldLayout": "Free",
|
||||||
@ -425,7 +425,48 @@
|
|||||||
"limitBehavior": "MoveLastOne",
|
"limitBehavior": "MoveLastOne",
|
||||||
"pivotX": 0,
|
"pivotX": 0,
|
||||||
"pivotY": 0,
|
"pivotY": 0,
|
||||||
"fieldDefs": []
|
"fieldDefs": [
|
||||||
|
{
|
||||||
|
"identifier": "Toggle",
|
||||||
|
"doc": null,
|
||||||
|
"__type": "Tile",
|
||||||
|
"uid": 75,
|
||||||
|
"type": "F_Tile",
|
||||||
|
"isArray": false,
|
||||||
|
"canBeNull": true,
|
||||||
|
"arrayMinLength": null,
|
||||||
|
"arrayMaxLength": null,
|
||||||
|
"editorDisplayMode": "Hidden",
|
||||||
|
"editorDisplayScale": 1,
|
||||||
|
"editorDisplayPos": "Above",
|
||||||
|
"editorLinkStyle": "StraightArrow",
|
||||||
|
"editorDisplayColor": null,
|
||||||
|
"editorAlwaysShow": false,
|
||||||
|
"editorShowInWorld": true,
|
||||||
|
"editorCutLongValues": true,
|
||||||
|
"editorTextSuffix": null,
|
||||||
|
"editorTextPrefix": null,
|
||||||
|
"useForSmartColor": false,
|
||||||
|
"exportToToc": false,
|
||||||
|
"searchable": false,
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"regex": null,
|
||||||
|
"acceptFileTypes": null,
|
||||||
|
"defaultOverride": {
|
||||||
|
"id": "V_String",
|
||||||
|
"params": ["64,128,32,32"]
|
||||||
|
},
|
||||||
|
"textLanguageMode": null,
|
||||||
|
"symmetricalRef": false,
|
||||||
|
"autoChainRef": true,
|
||||||
|
"allowOutOfLevelRef": true,
|
||||||
|
"allowedRefs": "OnlySame",
|
||||||
|
"allowedRefsEntityUid": null,
|
||||||
|
"allowedRefTags": [],
|
||||||
|
"tilesetUid": 57
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"identifier": "Switch",
|
"identifier": "Switch",
|
||||||
@ -468,7 +509,7 @@
|
|||||||
"uid": 69,
|
"uid": 69,
|
||||||
"type": "F_EntityRef",
|
"type": "F_EntityRef",
|
||||||
"isArray": false,
|
"isArray": false,
|
||||||
"canBeNull": true,
|
"canBeNull": false,
|
||||||
"arrayMinLength": null,
|
"arrayMinLength": null,
|
||||||
"arrayMaxLength": null,
|
"arrayMaxLength": null,
|
||||||
"editorDisplayMode": "RefLinkBetweenCenters",
|
"editorDisplayMode": "RefLinkBetweenCenters",
|
||||||
@ -497,6 +538,46 @@
|
|||||||
"allowedRefsEntityUid": 65,
|
"allowedRefsEntityUid": 65,
|
||||||
"allowedRefTags": [],
|
"allowedRefTags": [],
|
||||||
"tilesetUid": null
|
"tilesetUid": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "Toggle",
|
||||||
|
"doc": null,
|
||||||
|
"__type": "Tile",
|
||||||
|
"uid": 74,
|
||||||
|
"type": "F_Tile",
|
||||||
|
"isArray": false,
|
||||||
|
"canBeNull": true,
|
||||||
|
"arrayMinLength": null,
|
||||||
|
"arrayMaxLength": null,
|
||||||
|
"editorDisplayMode": "Hidden",
|
||||||
|
"editorDisplayScale": 1,
|
||||||
|
"editorDisplayPos": "Above",
|
||||||
|
"editorLinkStyle": "StraightArrow",
|
||||||
|
"editorDisplayColor": null,
|
||||||
|
"editorAlwaysShow": false,
|
||||||
|
"editorShowInWorld": true,
|
||||||
|
"editorCutLongValues": true,
|
||||||
|
"editorTextSuffix": null,
|
||||||
|
"editorTextPrefix": null,
|
||||||
|
"useForSmartColor": false,
|
||||||
|
"exportToToc": false,
|
||||||
|
"searchable": false,
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"regex": null,
|
||||||
|
"acceptFileTypes": null,
|
||||||
|
"defaultOverride": {
|
||||||
|
"id": "V_String",
|
||||||
|
"params": ["96,192,32,32"]
|
||||||
|
},
|
||||||
|
"textLanguageMode": null,
|
||||||
|
"symmetricalRef": false,
|
||||||
|
"autoChainRef": true,
|
||||||
|
"allowOutOfLevelRef": true,
|
||||||
|
"allowedRefs": "OnlySame",
|
||||||
|
"allowedRefsEntityUid": null,
|
||||||
|
"allowedRefTags": [],
|
||||||
|
"tilesetUid": 57
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -570,6 +651,46 @@
|
|||||||
"allowedRefsEntityUid": 66,
|
"allowedRefsEntityUid": 66,
|
||||||
"allowedRefTags": [],
|
"allowedRefTags": [],
|
||||||
"tilesetUid": null
|
"tilesetUid": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "Toggle",
|
||||||
|
"doc": null,
|
||||||
|
"__type": "Tile",
|
||||||
|
"uid": 71,
|
||||||
|
"type": "F_Tile",
|
||||||
|
"isArray": false,
|
||||||
|
"canBeNull": true,
|
||||||
|
"arrayMinLength": null,
|
||||||
|
"arrayMaxLength": null,
|
||||||
|
"editorDisplayMode": "Hidden",
|
||||||
|
"editorDisplayScale": 1,
|
||||||
|
"editorDisplayPos": "Above",
|
||||||
|
"editorLinkStyle": "StraightArrow",
|
||||||
|
"editorDisplayColor": null,
|
||||||
|
"editorAlwaysShow": false,
|
||||||
|
"editorShowInWorld": true,
|
||||||
|
"editorCutLongValues": true,
|
||||||
|
"editorTextSuffix": null,
|
||||||
|
"editorTextPrefix": null,
|
||||||
|
"useForSmartColor": false,
|
||||||
|
"exportToToc": false,
|
||||||
|
"searchable": false,
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"regex": null,
|
||||||
|
"acceptFileTypes": null,
|
||||||
|
"defaultOverride": {
|
||||||
|
"id": "V_String",
|
||||||
|
"params": ["64,192,32,32"]
|
||||||
|
},
|
||||||
|
"textLanguageMode": null,
|
||||||
|
"symmetricalRef": false,
|
||||||
|
"autoChainRef": true,
|
||||||
|
"allowOutOfLevelRef": true,
|
||||||
|
"allowedRefs": "OnlySame",
|
||||||
|
"allowedRefsEntityUid": null,
|
||||||
|
"allowedRefTags": [],
|
||||||
|
"tilesetUid": 57
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -1053,13 +1174,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__cWid": 4,
|
"__cWid": 4,
|
||||||
"__cHei": 6,
|
"__cHei": 7,
|
||||||
"identifier": "Entitymap",
|
"identifier": "Entitymap",
|
||||||
"uid": 57,
|
"uid": 57,
|
||||||
"relPath": "../sprites/entitymap.png",
|
"relPath": "../sprites/entitymap.png",
|
||||||
"embedAtlas": null,
|
"embedAtlas": null,
|
||||||
"pxWid": 128,
|
"pxWid": 128,
|
||||||
"pxHei": 192,
|
"pxHei": 224,
|
||||||
"tileGridSize": 32,
|
"tileGridSize": 32,
|
||||||
"spacing": 0,
|
"spacing": 0,
|
||||||
"padding": 0,
|
"padding": 0,
|
||||||
@ -1069,8 +1190,8 @@
|
|||||||
"customData": [],
|
"customData": [],
|
||||||
"savedSelections": [],
|
"savedSelections": [],
|
||||||
"cachedPixelData": {
|
"cachedPixelData": {
|
||||||
"opaqueTiles": "000000000111111111111100",
|
"opaqueTiles": "0000000001111111111111000000",
|
||||||
"averageColors": "1b47987d687d3b355c355c355c355c353c96faa8f166f299f5b7f853f799f777f222f888f444f765f555f53200000000"
|
"averageColors": "1b47987d687d3b355c355c355c355c353c96faa8f166f299f5b7f853f799f777f222f888f444f765f555f532e866ab85000000003743aa95"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
], "enums": [], "externalEnums": [], "levelFields": [
|
], "enums": [], "externalEnums": [], "levelFields": [
|
||||||
@ -3960,7 +4081,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [192,224],
|
"px": [192,224],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": -32,
|
"__worldX": -32,
|
||||||
"__worldY": 1856
|
"__worldY": 1856
|
||||||
},
|
},
|
||||||
@ -3976,7 +4097,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [320,320],
|
"px": [320,320],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 96,
|
"__worldX": 96,
|
||||||
"__worldY": 1952
|
"__worldY": 1952
|
||||||
},
|
},
|
||||||
@ -4040,7 +4161,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [416,224],
|
"px": [416,224],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 192,
|
"__worldX": 192,
|
||||||
"__worldY": 1856
|
"__worldY": 1856
|
||||||
}
|
}
|
||||||
@ -4200,7 +4321,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [192,224],
|
"px": [192,224],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 672,
|
"__worldX": 672,
|
||||||
"__worldY": 1856
|
"__worldY": 1856
|
||||||
},
|
},
|
||||||
@ -4280,7 +4401,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [192,96],
|
"px": [192,96],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 672,
|
"__worldX": 672,
|
||||||
"__worldY": 1728
|
"__worldY": 1728
|
||||||
},
|
},
|
||||||
@ -4486,7 +4607,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [64,224],
|
"px": [64,224],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 1248,
|
"__worldX": 1248,
|
||||||
"__worldY": 1856
|
"__worldY": 1856
|
||||||
},
|
},
|
||||||
@ -4518,7 +4639,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [128,160],
|
"px": [128,160],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 1312,
|
"__worldX": 1312,
|
||||||
"__worldY": 1792
|
"__worldY": 1792
|
||||||
},
|
},
|
||||||
@ -4841,7 +4962,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [416,96],
|
"px": [416,96],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2304,
|
"__worldX": 2304,
|
||||||
"__worldY": 1728
|
"__worldY": 1728
|
||||||
},
|
},
|
||||||
@ -4857,7 +4978,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [416,352],
|
"px": [416,352],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2304,
|
"__worldX": 2304,
|
||||||
"__worldY": 1984
|
"__worldY": 1984
|
||||||
},
|
},
|
||||||
@ -4905,7 +5026,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [288,128],
|
"px": [288,128],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2176,
|
"__worldX": 2176,
|
||||||
"__worldY": 1760
|
"__worldY": 1760
|
||||||
},
|
},
|
||||||
@ -4921,7 +5042,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [192,256],
|
"px": [192,256],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2080,
|
"__worldX": 2080,
|
||||||
"__worldY": 1888
|
"__worldY": 1888
|
||||||
},
|
},
|
||||||
@ -4937,7 +5058,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [480,288],
|
"px": [480,288],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2368,
|
"__worldX": 2368,
|
||||||
"__worldY": 1920
|
"__worldY": 1920
|
||||||
},
|
},
|
||||||
@ -4953,7 +5074,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [480,64],
|
"px": [480,64],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2368,
|
"__worldX": 2368,
|
||||||
"__worldY": 1696
|
"__worldY": 1696
|
||||||
},
|
},
|
||||||
@ -4969,7 +5090,7 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 24,
|
"defUid": 24,
|
||||||
"px": [512,128],
|
"px": [512,128],
|
||||||
"fieldInstances": [],
|
"fieldInstances": [{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 128, "w": 32, "h": 32 }, "__tile": null, "defUid": 75, "realEditorValues": [] }],
|
||||||
"__worldX": 2400,
|
"__worldX": 2400,
|
||||||
"__worldY": 1760
|
"__worldY": 1760
|
||||||
},
|
},
|
||||||
@ -6072,15 +6193,18 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 66,
|
"defUid": 66,
|
||||||
"px": [352,160],
|
"px": [352,160],
|
||||||
"fieldInstances": [{ "__identifier": "Entity_ref", "__type": "EntityRef", "__value": {
|
"fieldInstances": [
|
||||||
"entityIid": "81e502b0-d7b0-11ee-9add-6193c766edeb",
|
{ "__identifier": "Entity_ref", "__type": "EntityRef", "__value": {
|
||||||
"layerIid": "50624190-d7b0-11ee-968e-3dbcbdc42f40",
|
"entityIid": "81e502b0-d7b0-11ee-9add-6193c766edeb",
|
||||||
"levelIid": "50621a80-d7b0-11ee-968e-a98c2d35fbdb",
|
"layerIid": "50624190-d7b0-11ee-968e-3dbcbdc42f40",
|
||||||
"worldIid": "267ee1a0-d7b0-11ee-a97e-53f0a359eae1"
|
"levelIid": "50621a80-d7b0-11ee-968e-a98c2d35fbdb",
|
||||||
}, "__tile": null, "defUid": 69, "realEditorValues": [{
|
"worldIid": "267ee1a0-d7b0-11ee-a97e-53f0a359eae1"
|
||||||
"id": "V_String",
|
}, "__tile": null, "defUid": 69, "realEditorValues": [{
|
||||||
"params": ["81e502b0-d7b0-11ee-9add-6193c766edeb"]
|
"id": "V_String",
|
||||||
}] }],
|
"params": ["81e502b0-d7b0-11ee-9add-6193c766edeb"]
|
||||||
|
}] },
|
||||||
|
{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 96, "y": 192, "w": 32, "h": 32 }, "__tile": null, "defUid": 74, "realEditorValues": [] }
|
||||||
|
],
|
||||||
"__worldX": 128,
|
"__worldX": 128,
|
||||||
"__worldY": 2912
|
"__worldY": 2912
|
||||||
},
|
},
|
||||||
@ -6096,15 +6220,10 @@
|
|||||||
"height": 32,
|
"height": 32,
|
||||||
"defUid": 65,
|
"defUid": 65,
|
||||||
"px": [224,224],
|
"px": [224,224],
|
||||||
"fieldInstances": [{ "__identifier": "Entity_ref", "__type": "EntityRef", "__value": {
|
"fieldInstances": [
|
||||||
"entityIid": "7d975370-d7b0-11ee-9add-971995295000",
|
{ "__identifier": "Entity_ref", "__type": "EntityRef", "__value": null, "__tile": null, "defUid": 68, "realEditorValues": [null] },
|
||||||
"layerIid": "50624190-d7b0-11ee-968e-3dbcbdc42f40",
|
{ "__identifier": "Toggle", "__type": "Tile", "__value": { "tilesetUid": 57, "x": 64, "y": 192, "w": 32, "h": 32 }, "__tile": null, "defUid": 71, "realEditorValues": [] }
|
||||||
"levelIid": "50621a80-d7b0-11ee-968e-a98c2d35fbdb",
|
],
|
||||||
"worldIid": "267ee1a0-d7b0-11ee-a97e-53f0a359eae1"
|
|
||||||
}, "__tile": null, "defUid": 68, "realEditorValues": [{
|
|
||||||
"id": "V_String",
|
|
||||||
"params": ["7d975370-d7b0-11ee-9add-971995295000"]
|
|
||||||
}] }],
|
|
||||||
"__worldX": 0,
|
"__worldX": 0,
|
||||||
"__worldY": 2976
|
"__worldY": 2976
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,53 +17,53 @@ var Tiles = InitTiles()
|
|||||||
// Tile: contains image, identifier (as used in level data) and
|
// Tile: contains image, identifier (as used in level data) and
|
||||||
// additional properties
|
// additional properties
|
||||||
type Tile struct {
|
type Tile struct {
|
||||||
Id, Ref string
|
Id, Ref string
|
||||||
Sprite *ebiten.Image
|
Sprite *ebiten.Image
|
||||||
Class string
|
ToggleSprite *ebiten.Image
|
||||||
Solid bool // wall brick
|
Solid bool // wall brick
|
||||||
Player bool // player sphere
|
Player bool // player sphere
|
||||||
IsPrimary bool // primary player sphere
|
IsPrimary bool // primary player sphere
|
||||||
Renderable bool // visible, has sprite
|
Renderable bool // visible, has sprite
|
||||||
Velocity bool // movable
|
Velocity bool // movable
|
||||||
Collectible bool // collectible, vanishes once collected
|
Collectible bool // collectible, vanishes once collected
|
||||||
Transient bool // turns into brick wall when traversed
|
Transient bool // turns into brick wall when traversed
|
||||||
Destroyable bool // turns into empty floor when bumped into twice
|
Destroyable bool // turns into empty floor when bumped into twice
|
||||||
Particle int // -1=unused, 0-3 = show image of slice
|
Particle int // -1=unused, 0-3 = show image of slice
|
||||||
Tiles []*ebiten.Image // has N sprites
|
Tiles []*ebiten.Image // has N sprites
|
||||||
TileNames []string // same thing, only the names
|
TileNames []string // same thing, only the names
|
||||||
Obstacle bool // is an obstacle/enemy
|
Obstacle bool // is an obstacle/enemy
|
||||||
Direction int // obstacle business end shows into this direction
|
Direction int // obstacle business end shows into this direction
|
||||||
Shader *ebiten.Shader
|
Shader *ebiten.Shader
|
||||||
Alpha *ebiten.Image
|
Alpha *ebiten.Image
|
||||||
Bond bool // denotes an entity which can have a relation to another
|
Bond bool // denotes an entity which can have a relation to another
|
||||||
Door bool // a door, can be manipulated by a switch
|
Door bool // a door, can be manipulated by a switch
|
||||||
Switch bool // opens|closes a door
|
Switch bool // opens|closes a door
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tile *Tile) Clone() *Tile {
|
func (tile *Tile) Clone() *Tile {
|
||||||
newtile := &Tile{
|
newtile := &Tile{
|
||||||
Id: tile.Id,
|
Id: tile.Id,
|
||||||
Ref: tile.Ref,
|
Ref: tile.Ref,
|
||||||
Sprite: tile.Sprite,
|
Sprite: tile.Sprite,
|
||||||
Class: tile.Class,
|
ToggleSprite: tile.ToggleSprite,
|
||||||
Solid: tile.Solid,
|
Solid: tile.Solid,
|
||||||
Player: tile.Player,
|
Player: tile.Player,
|
||||||
IsPrimary: tile.IsPrimary,
|
IsPrimary: tile.IsPrimary,
|
||||||
Renderable: tile.Renderable,
|
Renderable: tile.Renderable,
|
||||||
Velocity: tile.Velocity,
|
Velocity: tile.Velocity,
|
||||||
Collectible: tile.Collectible,
|
Collectible: tile.Collectible,
|
||||||
Transient: tile.Transient,
|
Transient: tile.Transient,
|
||||||
Destroyable: tile.Destroyable,
|
Destroyable: tile.Destroyable,
|
||||||
Particle: tile.Particle,
|
Particle: tile.Particle,
|
||||||
Tiles: tile.Tiles,
|
Tiles: tile.Tiles,
|
||||||
TileNames: tile.TileNames,
|
TileNames: tile.TileNames,
|
||||||
Obstacle: tile.Obstacle,
|
Obstacle: tile.Obstacle,
|
||||||
Direction: tile.Direction,
|
Direction: tile.Direction,
|
||||||
Alpha: tile.Alpha,
|
Alpha: tile.Alpha,
|
||||||
Shader: tile.Shader,
|
Shader: tile.Shader,
|
||||||
Bond: tile.Bond,
|
Bond: tile.Bond,
|
||||||
Door: tile.Door,
|
Door: tile.Door,
|
||||||
Switch: tile.Switch,
|
Switch: tile.Switch,
|
||||||
}
|
}
|
||||||
|
|
||||||
return newtile
|
return newtile
|
||||||
@ -86,7 +86,6 @@ func GetSprites(class []string) []*ebiten.Image {
|
|||||||
|
|
||||||
func NewTilePlayer(isprimary bool) *Tile {
|
func NewTilePlayer(isprimary bool) *Tile {
|
||||||
tile := &Tile{
|
tile := &Tile{
|
||||||
Class: "sphere",
|
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Player: true,
|
Player: true,
|
||||||
Velocity: true,
|
Velocity: true,
|
||||||
@ -105,29 +104,23 @@ func NewTilePlayer(isprimary bool) *Tile {
|
|||||||
return tile
|
return tile
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileBlock(class string) *Tile {
|
func NewTileBlock() *Tile {
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Sprite: Assets[class],
|
|
||||||
Class: class,
|
|
||||||
Solid: true,
|
Solid: true,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileCollectible(class string) *Tile {
|
func NewTileCollectible() *Tile {
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Sprite: Assets[class],
|
|
||||||
Class: class,
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Collectible: true,
|
Collectible: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileObstacle(class string, direction int) *Tile {
|
func NewTileObstacle(direction int) *Tile {
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Sprite: Assets[class],
|
|
||||||
Class: class,
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Obstacle: true,
|
Obstacle: true,
|
||||||
@ -140,7 +133,6 @@ func NewTileParticle(class []string) *Tile {
|
|||||||
sprites := GetSprites(class)
|
sprites := GetSprites(class)
|
||||||
|
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Class: "particle",
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: false,
|
Renderable: false,
|
||||||
Particle: 0,
|
Particle: 0,
|
||||||
@ -148,57 +140,39 @@ func NewTileParticle(class []string) *Tile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileTranswall(class []string) *Tile {
|
func NewTileTranswall() *Tile {
|
||||||
sprites := GetSprites(class)
|
|
||||||
|
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Class: "transwall",
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Transient: true,
|
Transient: true,
|
||||||
Tiles: sprites,
|
|
||||||
Sprite: sprites[0], // initially use the first
|
|
||||||
TileNames: class,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileHiddenDoor(class, alpha string) *Tile {
|
func NewTileHiddenDoor(alpha string) *Tile {
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Class: "hiddendoor",
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Destroyable: true,
|
Destroyable: true,
|
||||||
Sprite: Assets[class],
|
|
||||||
Alpha: Assets[alpha],
|
Alpha: Assets[alpha],
|
||||||
Shader: Shaders["destruct"],
|
Shader: Shaders["destruct"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileSwitch(class []string) *Tile {
|
func NewTileSwitch() *Tile {
|
||||||
sprites := GetSprites(class)
|
|
||||||
|
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Class: "switch",
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Bond: true,
|
Bond: true,
|
||||||
Switch: true,
|
Switch: true,
|
||||||
Tiles: sprites,
|
|
||||||
Sprite: sprites[0], // initially use the first
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTileDoor(class []string) *Tile {
|
func NewTileDoor() *Tile {
|
||||||
sprites := GetSprites(class)
|
|
||||||
|
|
||||||
return &Tile{
|
return &Tile{
|
||||||
Class: "door",
|
|
||||||
Solid: false,
|
Solid: false,
|
||||||
Renderable: true,
|
Renderable: true,
|
||||||
Bond: true,
|
Bond: true,
|
||||||
Door: true,
|
Door: true,
|
||||||
Tiles: sprites,
|
|
||||||
Sprite: sprites[0], // initially use the first
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,17 +181,17 @@ type TileRegistry map[string]*Tile
|
|||||||
|
|
||||||
func InitTiles() TileRegistry {
|
func InitTiles() TileRegistry {
|
||||||
return TileRegistry{
|
return TileRegistry{
|
||||||
"floor": {Class: "floor", Renderable: false},
|
"floor": {Renderable: false},
|
||||||
"default": NewTileBlock("block-greycolored"),
|
"default": NewTileBlock(),
|
||||||
"solidorange": NewTileBlock("block-orange-32"),
|
"solidorange": NewTileBlock(),
|
||||||
"PlayerPrimary": NewTilePlayer(Primary),
|
"PlayerPrimary": NewTilePlayer(Primary),
|
||||||
"PlayerSecondary": NewTilePlayer(Secondary),
|
"PlayerSecondary": NewTilePlayer(Secondary),
|
||||||
"Collectible": NewTileCollectible("collectible-orange"),
|
"Collectible": NewTileCollectible(),
|
||||||
"ObstacleStar": NewTileObstacle("obstacle-star", config.All),
|
"ObstacleStar": NewTileObstacle(config.All),
|
||||||
"ObstacleNorth": NewTileObstacle("obstacle-north", config.North),
|
"ObstacleNorth": NewTileObstacle(config.North),
|
||||||
"ObstacleSouth": NewTileObstacle("obstacle-south", config.South),
|
"ObstacleSouth": NewTileObstacle(config.South),
|
||||||
"ObstacleWest": NewTileObstacle("obstacle-west", config.West),
|
"ObstacleWest": NewTileObstacle(config.West),
|
||||||
"ObstacleEast": NewTileObstacle("obstacle-east", config.East),
|
"ObstacleEast": NewTileObstacle(config.East),
|
||||||
"Particle": NewTileParticle([]string{
|
"Particle": NewTileParticle([]string{
|
||||||
"particle-ring-1",
|
"particle-ring-1",
|
||||||
"particle-ring-2",
|
"particle-ring-2",
|
||||||
@ -226,22 +200,22 @@ func InitTiles() TileRegistry {
|
|||||||
"particle-ring-5",
|
"particle-ring-5",
|
||||||
"particle-ring-6",
|
"particle-ring-6",
|
||||||
}),
|
}),
|
||||||
"Transient": NewTileTranswall([]string{"transwall", "block-orange-32"}),
|
"Transient": NewTileTranswall(),
|
||||||
"HiddenDoor": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor2": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor2": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor3": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor3": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor4": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor4": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor5": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor5": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor6": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor6": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor7": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor7": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor8": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor8": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor9": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor9": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor10": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor10": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor11": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor11": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor12": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor12": NewTileHiddenDoor("damage"),
|
||||||
"HiddenDoor13": NewTileHiddenDoor("block-greycolored", "damage"),
|
"HiddenDoor13": NewTileHiddenDoor("damage"),
|
||||||
"Switch": NewTileSwitch([]string{"switch1", "switch2"}),
|
"Switch": NewTileSwitch(),
|
||||||
"Door": NewTileDoor([]string{"door1", "door2"}),
|
"Door": NewTileDoor(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 33 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 503 B |
Binary file not shown.
|
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 543 B |
BIN
assets/sprites/woddendoor.ase
Normal file
BIN
assets/sprites/woddendoor.ase
Normal file
Binary file not shown.
@ -7,6 +7,7 @@ import (
|
|||||||
// virtual location, aka tile address
|
// virtual location, aka tile address
|
||||||
|
|
||||||
type Renderable struct {
|
type Renderable struct {
|
||||||
|
Pos *Position // just for debugging, will not used as positiion!
|
||||||
Image *ebiten.Image
|
Image *ebiten.Image
|
||||||
DamageImage *ebiten.Image
|
DamageImage *ebiten.Image
|
||||||
Damaged int
|
Damaged int
|
||||||
|
|||||||
@ -1,24 +1,10 @@
|
|||||||
package components
|
package components
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Transient struct {
|
type Transient struct {
|
||||||
Activated bool
|
Activated bool
|
||||||
Sprites []string
|
Wall *ebiten.Image
|
||||||
Current int // sprite index
|
|
||||||
}
|
|
||||||
|
|
||||||
func (trans *Transient) GetNext() string {
|
|
||||||
if len(trans.Sprites) > trans.Current {
|
|
||||||
trans.Current++
|
|
||||||
return trans.Sprites[trans.Current]
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Fatalf("not enough sprites in transient tile, have %d sprites, index requested: %d",
|
|
||||||
len(trans.Sprites), trans.Current+1,
|
|
||||||
)
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,13 +13,18 @@ const (
|
|||||||
All
|
All
|
||||||
)
|
)
|
||||||
|
|
||||||
const PLAYERSPEED int = 5
|
const (
|
||||||
const PARTICLE_LOOPWAIT time.Duration = 250 * time.Millisecond
|
PLAYERSPEED int = 5
|
||||||
const LEVEL_END_WAIT time.Duration = 500 * time.Millisecond
|
PARTICLE_LOOPWAIT time.Duration = 250 * time.Millisecond
|
||||||
const version string = "1.2.2"
|
LEVEL_END_WAIT time.Duration = 500 * time.Millisecond
|
||||||
|
version string = "1.2.3"
|
||||||
|
|
||||||
const MenuRectX int = 600
|
MenuRectX int = 600
|
||||||
const MenuRectY int = 0
|
MenuRectY int = 0
|
||||||
const MenuRectCellsize int = 32
|
MenuRectCellsize int = 32
|
||||||
|
|
||||||
|
LDTK_Entity_Ref string = "Entity_ref"
|
||||||
|
LDTK_Toggle_Tile string = "Toggle"
|
||||||
|
)
|
||||||
|
|
||||||
var VERSION string // maintained by -x
|
var VERSION string // maintained by -x
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import (
|
|||||||
"openquell/grid"
|
"openquell/grid"
|
||||||
"openquell/observers"
|
"openquell/observers"
|
||||||
"openquell/systems"
|
"openquell/systems"
|
||||||
|
"openquell/util"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
@ -173,20 +174,27 @@ func LevelToSlice(game *Game, level *ldtkgo.Level, tilesize int) (Map, Map) {
|
|||||||
tile := assets.Tiles[entity.Identifier]
|
tile := assets.Tiles[entity.Identifier]
|
||||||
tile.Id = entity.IID
|
tile.Id = entity.IID
|
||||||
|
|
||||||
ref := entity.PropertyByIdentifier("Entity_ref")
|
toggleRect := util.GetPropertyToggleTile(entity)
|
||||||
if ref != nil {
|
if toggleRect != nil {
|
||||||
if ref.Value != nil {
|
tile.ToggleSprite = tileset.SubImage(
|
||||||
refid := ref.Value.(map[string]interface{})
|
image.Rect(toggleRect.X, toggleRect.Y,
|
||||||
tile.Ref = refid["entityIid"].(string)
|
toggleRect.X+toggleRect.W,
|
||||||
slog.Debug("LOAD TILE", "tileref",
|
toggleRect.Y+toggleRect.H)).(*ebiten.Image)
|
||||||
tile.Ref, "tileid", tile.Id,
|
|
||||||
"name", entity.Identifier,
|
|
||||||
"isswitch", tile.Switch,
|
|
||||||
"isdoor", tile.Door,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tile.Ref = util.GetPropertyRef(entity)
|
||||||
|
if tile.Transient {
|
||||||
|
slog.Debug("LOAD TILE", "tileref",
|
||||||
|
tile.Ref, "tileid", tile.Id,
|
||||||
|
"name", entity.Identifier,
|
||||||
|
"isswitch", tile.Switch,
|
||||||
|
"isdoor", tile.Door,
|
||||||
|
"togglerect", toggleRect,
|
||||||
|
"tilerect", entity.TileRect,
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
tileRect := entity.TileRect
|
tileRect := entity.TileRect
|
||||||
|
|
||||||
tile.Sprite = tileset.SubImage(
|
tile.Sprite = tileset.SubImage(
|
||||||
|
|||||||
27
grid/grid.go
27
grid/grid.go
@ -126,7 +126,7 @@ func NewGrid(world *ecs.World,
|
|||||||
case tile.Transient:
|
case tile.Transient:
|
||||||
entity := transmapper.New()
|
entity := transmapper.New()
|
||||||
pos, render, transient = transmapper.Get(entity)
|
pos, render, transient = transmapper.Get(entity)
|
||||||
transient.Sprites = tile.TileNames
|
transient.Wall = tile.ToggleSprite
|
||||||
|
|
||||||
case tile.Destroyable:
|
case tile.Destroyable:
|
||||||
entity := destructiblemapper.New()
|
entity := destructiblemapper.New()
|
||||||
@ -139,16 +139,16 @@ func NewGrid(world *ecs.World,
|
|||||||
case tile.Switch:
|
case tile.Switch:
|
||||||
entity := switchmapper.New()
|
entity := switchmapper.New()
|
||||||
pos, render, _, switcher = switchmapper.Get(entity)
|
pos, render, _, switcher = switchmapper.Get(entity)
|
||||||
switcher.CloseSprite = tile.Tiles[0]
|
switcher.CloseSprite = tile.Sprite
|
||||||
switcher.OpenSprite = tile.Tiles[1]
|
switcher.OpenSprite = tile.ToggleSprite
|
||||||
switcher.Ref = tile.Ref
|
switcher.Ref = tile.Ref
|
||||||
switches = append(switches, entity)
|
switches = append(switches, entity)
|
||||||
|
|
||||||
case tile.Door:
|
case tile.Door:
|
||||||
entity := doormapper.New()
|
entity := doormapper.New()
|
||||||
pos, render, _, door = doormapper.Get(entity)
|
pos, render, _, door = doormapper.Get(entity)
|
||||||
door.CloseSprite = tile.Tiles[0]
|
door.CloseSprite = tile.Sprite
|
||||||
door.OpenSprite = tile.Tiles[1]
|
door.OpenSprite = tile.ToggleSprite
|
||||||
door.Id = tile.Id
|
door.Id = tile.Id
|
||||||
doors = append(doors, entity)
|
doors = append(doors, entity)
|
||||||
|
|
||||||
@ -156,11 +156,8 @@ func NewGrid(world *ecs.World,
|
|||||||
log.Fatalln("unsupported tile type encountered")
|
log.Fatalln("unsupported tile type encountered")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this image is never being used because it is
|
|
||||||
// being overwritten in game/levels.go:LevelToSlice(). The
|
|
||||||
// image is taken from the LDTK map, not from the Tile{}
|
|
||||||
// definition anymore
|
|
||||||
render.Image = tile.Sprite
|
render.Image = tile.Sprite
|
||||||
|
render.Pos = pos
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// empty cell, this is where the player[s] move. No
|
// empty cell, this is where the player[s] move. No
|
||||||
@ -227,17 +224,5 @@ func (grid *Grid) SetFloorTile(point image.Point) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (grid *Grid) SetSolidTile(tile *assets.Tile, point image.Point) {
|
func (grid *Grid) SetSolidTile(tile *assets.Tile, point image.Point) {
|
||||||
solidmapper := generic.NewMap4[
|
|
||||||
components.Position,
|
|
||||||
components.Renderable,
|
|
||||||
components.Tilish,
|
|
||||||
components.Solid](grid.World)
|
|
||||||
|
|
||||||
grid.Map[point] = tile
|
grid.Map[point] = tile
|
||||||
|
|
||||||
entity := solidmapper.New()
|
|
||||||
pos, render, _, _ := solidmapper.Get(entity)
|
|
||||||
|
|
||||||
render.Image = tile.Sprite
|
|
||||||
pos.Update(point.X*grid.Tilesize, point.Y*grid.Tilesize, grid.Tilesize)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@ -1,6 +1,7 @@
|
|||||||
package systems
|
package systems
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log/slog"
|
||||||
. "openquell/components"
|
. "openquell/components"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
@ -53,10 +54,13 @@ func (system *GridSystem) Draw(screen *ebiten.Image) {
|
|||||||
counter := 0
|
counter := 0
|
||||||
for query.Next() {
|
for query.Next() {
|
||||||
sprite, pos, _ := query.Get()
|
sprite, pos, _ := query.Get()
|
||||||
|
|
||||||
counter++
|
counter++
|
||||||
op.GeoM.Reset()
|
op.GeoM.Reset()
|
||||||
op.GeoM.Translate(float64(pos.X), float64(pos.Y))
|
op.GeoM.Translate(float64(pos.X), float64(pos.Y))
|
||||||
|
slog.Debug("rendering tile", "sprite", sprite)
|
||||||
system.Cache.DrawImage(sprite.Image, op)
|
system.Cache.DrawImage(sprite.Image, op)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op.GeoM.Reset()
|
op.GeoM.Reset()
|
||||||
|
|||||||
@ -72,6 +72,7 @@ func (system *PairSystem) Update() error {
|
|||||||
if ok {
|
if ok {
|
||||||
// player moved on top of the switch
|
// player moved on top of the switch
|
||||||
switcher.Toggle()
|
switcher.Toggle()
|
||||||
|
|
||||||
// open door
|
// open door
|
||||||
door := system.World.Relations().Get(query.Entity(), relID)
|
door := system.World.Relations().Get(query.Entity(), relID)
|
||||||
EntitiesToSwitch = append(EntitiesToSwitch,
|
EntitiesToSwitch = append(EntitiesToSwitch,
|
||||||
|
|||||||
@ -26,7 +26,7 @@ type TransientSystem struct {
|
|||||||
|
|
||||||
type TransientToWall struct {
|
type TransientToWall struct {
|
||||||
Entity ecs.Entity
|
Entity ecs.Entity
|
||||||
NewSprite string
|
NewSprite *ebiten.Image
|
||||||
Position components.Position
|
Position components.Position
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ func (system *TransientSystem) Update() error {
|
|||||||
EntitiestoMakeSolid = append(EntitiestoMakeSolid, TransientToWall{
|
EntitiestoMakeSolid = append(EntitiestoMakeSolid, TransientToWall{
|
||||||
Entity: query.Entity(),
|
Entity: query.Entity(),
|
||||||
Position: *transientposition,
|
Position: *transientposition,
|
||||||
NewSprite: transient.GetNext(),
|
NewSprite: transient.Wall,
|
||||||
})
|
})
|
||||||
slog.Debug("transient added to make solid")
|
slog.Debug("transient added to make solid")
|
||||||
}
|
}
|
||||||
@ -91,18 +91,20 @@ func (system *TransientSystem) Update() error {
|
|||||||
system.World.RemoveEntity(convertible.Entity)
|
system.World.RemoveEntity(convertible.Entity)
|
||||||
|
|
||||||
// replace with solid entity
|
// replace with solid entity
|
||||||
slog.Debug("transient add solid")
|
slog.Debug("transient add solid", "wall", convertible.NewSprite.Bounds())
|
||||||
entity := system.SolidMapper.New()
|
entity := system.SolidMapper.New()
|
||||||
pos, render, _, _ := system.SolidMapper.Get(entity)
|
pos, render, _, _ := system.SolidMapper.Get(entity)
|
||||||
|
|
||||||
// set it up apropriately
|
// set it up apropriately
|
||||||
pos.Set(&convertible.Position)
|
pos.Set(&convertible.Position)
|
||||||
render.Image = assets.Assets[convertible.NewSprite]
|
render.Image = convertible.NewSprite
|
||||||
|
render.Pos = pos
|
||||||
|
slog.Debug("new render", "render", render)
|
||||||
|
|
||||||
// also setup the grid tile with a new solid, so that
|
// also setup the grid tile with a new solid, so that
|
||||||
// collision detection works
|
// collision detection works
|
||||||
system.GridContainer.Grid.SetSolidTile(
|
system.GridContainer.Grid.SetSolidTile(
|
||||||
assets.NewTileBlock(convertible.NewSprite),
|
assets.NewTileBlock(),
|
||||||
convertible.Position.Point(),
|
convertible.Position.Point(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
48
util/ldtkhelpers.go
Normal file
48
util/ldtkhelpers.go
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"openquell/config"
|
||||||
|
|
||||||
|
"github.com/solarlune/ldtkgo"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TileSetSubRect struct {
|
||||||
|
X, Y, W, H int
|
||||||
|
}
|
||||||
|
|
||||||
|
func Map2Subrect(raw map[string]any) *TileSetSubRect {
|
||||||
|
|
||||||
|
// we need to translate this map for less typing
|
||||||
|
return &TileSetSubRect{
|
||||||
|
W: int(raw["w"].(float64)),
|
||||||
|
H: int(raw["h"].(float64)),
|
||||||
|
X: int(raw["x"].(float64)),
|
||||||
|
Y: int(raw["y"].(float64)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPropertyRef(entity *ldtkgo.Entity) string {
|
||||||
|
ref := entity.PropertyByIdentifier(config.LDTK_Entity_Ref)
|
||||||
|
if ref != nil {
|
||||||
|
if ref.Value != nil {
|
||||||
|
refid := ref.Value.(map[string]interface{})
|
||||||
|
ref := refid["entityIid"].(string)
|
||||||
|
|
||||||
|
if ref != "" {
|
||||||
|
return ref
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPropertyToggleTile(entity *ldtkgo.Entity) *TileSetSubRect {
|
||||||
|
|
||||||
|
ref := entity.PropertyByIdentifier(config.LDTK_Toggle_Tile)
|
||||||
|
if ref != nil {
|
||||||
|
return Map2Subrect(ref.AsMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user