test all the levels

This commit is contained in:
Corwin 2023-09-05 22:52:10 +01:00
parent 98d2dc0022
commit 962b503751
No known key found for this signature in database
44 changed files with 711 additions and 133 deletions

View file

@ -5,6 +5,7 @@ use std::{
io::{BufWriter, Write},
str::FromStr,
};
use tiled::{Map, ObjectLayer, TileLayer};
use proc_macro2::TokenStream;
@ -259,6 +260,7 @@ impl quote::ToTokens for EntityWithPosition {
struct Level {
starting_items: Vec<Entity>,
fixed_positions: Vec<EntityWithPosition>,
solution_positions: Vec<EntityWithPosition>,
directions: Vec<Direction>,
wall_bitmap: Vec<u8>,
name: String,
@ -268,6 +270,7 @@ impl quote::ToTokens for Level {
fn to_tokens(&self, tokens: &mut TokenStream) {
let wall_bitmap = &self.wall_bitmap;
let fixed_positions = &self.fixed_positions;
let solution_positions = &self.solution_positions;
let directions = &self.directions;
let starting_items = &self.starting_items;
let name = &self.name;
@ -276,6 +279,7 @@ impl quote::ToTokens for Level {
Level::new(
Map::new(11, 10, &[#(#wall_bitmap),*]),
&[#(#fixed_positions),*],
&[#(#solution_positions),*],
&[#(#directions),*],
&[#(#starting_items),*],
#name,
@ -284,10 +288,10 @@ impl quote::ToTokens for Level {
}
}
fn export_level(map: &tiled::Map) -> Level {
let objects = map.get_layer(1).unwrap().as_object_layer().unwrap();
let fixed_positions = objects.objects().map(|obj| {
fn extract_objects_from_layer(
objects: ObjectLayer<'_>,
) -> impl Iterator<Item = EntityWithPosition> + '_ {
objects.objects().map(|obj| {
let entity: Entity = obj
.name
.parse()
@ -297,7 +301,20 @@ fn export_level(map: &tiled::Map) -> Level {
let y = (obj.y / 16.0) as i32;
EntityWithPosition(entity, (x, y))
});
})
}
fn export_level(map: &tiled::Map) -> Level {
let objects = map
.get_object_layer("Puzzle")
.expect("The puzzle object layer should exist");
let fixed_positions = extract_objects_from_layer(objects);
let solution_positions = extract_objects_from_layer(
map.get_object_layer("Solution")
.expect("Should have an object layer called 'Solution'"),
);
let Some(tiled::PropertyValue::StringValue(starting_items)) = map.properties.get("ITEMS")
else {
@ -352,6 +369,7 @@ fn export_level(map: &tiled::Map) -> Level {
Level {
starting_items: starting_items.collect(),
fixed_positions: fixed_positions.collect(),
solution_positions: solution_positions.collect(),
directions: directions.collect(),
wall_bitmap: bool_to_bit(&are_walls.collect::<Vec<_>>()),
name: level_name.clone(),
@ -359,7 +377,9 @@ fn export_level(map: &tiled::Map) -> Level {
}
fn export_tiles(map: &tiled::Map, background: TokenStream) -> TokenStream {
let map_tiles = map.get_layer(0).unwrap().as_tile_layer().unwrap();
let map_tiles = map
.get_tile_layer("Ground")
.expect("The ground layer should exist");
let width = map_tiles.width().unwrap() * 2;
let height = map_tiles.height().unwrap() * 2;
@ -446,3 +466,22 @@ fn check_bool_to_bit() {
let bools = [true, false, false, false, true, true, true, true];
assert_eq!(bool_to_bit(&bools), [0b11110001]);
}
trait TiledMapExtensions {
fn get_object_layer(&self, name: &str) -> Option<ObjectLayer>;
fn get_tile_layer(&self, name: &str) -> Option<TileLayer>;
}
impl TiledMapExtensions for Map {
fn get_object_layer(&self, name: &str) -> Option<ObjectLayer> {
self.layers()
.find(|x| x.name == name)
.and_then(|x| x.as_object_layer())
}
fn get_tile_layer(&self, name: &str) -> Option<TileLayer> {
self.layers()
.find(|x| x.name == name)
.and_then(|x| x.as_tile_layer())
}
}

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="3">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="4">
<properties>
<property name="DIRECTIONS" value="LLRRRRR"/>
<property name="ITEMS" value="ICE"/>
<property name="NAME" value="A familiar sight..."/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="135.08" y="73.5784">
<point/>
</object>
@ -28,4 +28,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="3" name="ICE" x="55.0287" y="71.0787">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="12">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="17">
<properties>
<property name="DIRECTIONS" value="RRU"/>
<property name="ITEMS" value="ICE,ICE,ICE,TELEPORTER,TELEPORTER"/>
<property name="NAME" value="How fast can something go?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,1,2,9,0,1,8,6,9,
0,0,0,10,17,18,1,1073741852,17,12,18,
@ -20,7 +20,7 @@
0,0,0,0,0,0,19,26,23,27,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="72.2556" y="24.5112">
<point/>
</object>
@ -43,4 +43,21 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="12" name="ICE" x="120.834" y="102.72">
<point/>
</object>
<object id="13" name="ICE" x="119.229" y="86.2116">
<point/>
</object>
<object id="14" name="ICE" x="118.999" y="69.0151">
<point/>
</object>
<object id="15" name="TELEPORTER" x="118.541" y="37.3736">
<point/>
</object>
<object id="16" name="TELEPORTER" x="89.4216" y="55.4872">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="148">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="156">
<properties>
<property name="DIRECTIONS" value="DDDDLLLDLLLLD"/>
<property name="ITEMS" value="BLOCK,BLOCK,BLOCK,BLOCK,HERO,HERO,TELEPORTER,DOOR"/>
<property name="NAME" value="I must commend you, I'd have given up helping this useless hero by now. They're only going to get stuck again."/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
1,8,2,7,8,8,3,7,4,2,9,
46,17,13,17,13,12,12,15,11,16,38,
@ -20,7 +20,7 @@
0,19,24,20,25,20,27,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="27" name="ICE" x="87.1287" y="74.0594">
<point/>
</object>
@ -103,4 +103,30 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="148" name="BLOCK" x="23.8458" y="40.1251">
<point/>
</object>
<object id="149" name="BLOCK" x="24.5336" y="54.3408">
<point/>
</object>
<object id="150" name="TELEPORTER" x="23.1579" y="23.6165">
<point/>
</object>
<object id="151" name="DOOR" x="135.05" y="88.7337">
<point/>
</object>
<object id="152" name="BLOCK" x="135.737" y="103.179">
<point/>
</object>
<object id="153" name="BLOCK" x="101.574" y="102.72">
<point/>
</object>
<object id="154" name="HERO" x="119.229" y="38.5201">
<point/>
</object>
<object id="155" name="HERO" x="153.392" y="22.6993">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="164">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="178">
<properties>
<property name="DIRECTIONS" value="ULURULURULURULUR"/>
<property name="ITEMS" value="BLOCK,BLOCK,BLOCK,BLOCK,HERO,SQUID_DOWN,GLOVE"/>
<property name="NAME" value="I did warn you they were going to get stuck again. I can't think of a creature more useless."/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
1,8,2,7,8,8,3,9,1,2,9,
46,2147483676,22,23,28,12,12,38,19,26,27,
@ -20,7 +20,7 @@
19,22,22,20,25,22,26,25,26,24,27
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="148" name="ICE" x="70.8494" y="140.323">
<point/>
</object>
@ -46,4 +46,27 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="171" name="BLOCK" x="103.75" y="120.75">
<point/>
</object>
<object id="172" name="BLOCK" x="102.75" y="105.5">
<point/>
</object>
<object id="173" name="BLOCK" x="103" y="89.75">
<point/>
</object>
<object id="174" name="SQUID_DOWN" x="101.5" y="55.75">
<point/>
</object>
<object id="175" name="GLOVE" x="101.75" y="72.75">
<point/>
</object>
<object id="176" name="HERO" x="151.5" y="136.5">
<point/>
</object>
<object id="177" name="BLOCK" x="23.75" y="136.25">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="172">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="175">
<properties>
<property name="DIRECTIONS" value="LDDDD"/>
<property name="ITEMS" value="SQUID_UP,ICE,ICE"/>
<property name="NAME" value="In reality, a squid is a friend. They can't help but kill the hero, but they've been helping at every floor!"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,1,7,9,0,0,0,0,0,
0,0,1,1073741852,13,3221225500,8,9,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,19,24,27,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="164" name="HERO" x="120.022" y="72.8136">
<point/>
</object>
@ -40,4 +40,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="172" name="ICE" x="87" y="72">
<point/>
</object>
<object id="173" name="ICE" x="70.5" y="56.5">
<point/>
</object>
<object id="174" name="SQUID_UP" x="71.75" y="105.25">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="9">
<properties>
<property name="DIRECTIONS" value="LLLLLLLLUUUU"/>
<property name="ITEMS" value="BLOCK,BLOCK"/>
<property name="NAME" value="Less familiar, but exciting nonetheless"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,1,3,2,6,9,0,0,0,0,0,
0,46,15,14,13,3221225500,4,6,7,7,9,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="3" name="HERO" x="119.458" y="71.7665">
<point/>
</object>
@ -34,4 +34,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="BLOCK" x="54.3408" y="71.9958">
<point/>
</object>
<object id="8" name="BLOCK" x="86.2116" y="68.7858">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="14">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="15">
<properties>
<property name="DIRECTIONS" value="RRUURRDD"/>
<property name="ITEMS" value="GLOVE"/>
<property name="NAME" value="Should be simple for a dungoen puzzler such as yourself"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="7" name="STAIRS" x="103.179" y="87.8166">
<point/>
</object>
@ -37,4 +37,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="4" name="Solution">
<object id="14" name="GLOVE" x="87.1287" y="70.8494">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="20">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="22">
<properties>
<property name="DIRECTIONS" value="RRUURRDD"/>
<property name="ITEMS" value="BLOCK,ICE"/>
<property name="NAME" value="Wow, finally a level with nothing new introduced!"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,1,6,2,8,8,9,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="14" name="HERO" x="54.7994" y="55.9458">
<point/>
</object>
@ -37,4 +37,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="20" name="ICE" x="103.637" y="54.3408">
<point/>
</object>
<object id="21" name="BLOCK" x="87.358" y="53.8822">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="9">
<properties>
<property name="DIRECTIONS" value="LLLLLU"/>
<property name="ITEMS" value="KEY,BLOCK"/>
<property name="NAME" value="Hmmmm"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="134.623" y="90.0266">
<point/>
</object>
@ -37,4 +37,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="KEY" x="71.8693" y="86.8421">
<point/>
</object>
<object id="8" name="BLOCK" x="88.6388" y="86.8421">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="4">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="5">
<properties>
<property name="DIRECTIONS" value="RRRRRRRR"/>
<property name="ITEMS" value="BLOCK"/>
<property name="NAME" value="That hero won't survive the fall"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="135.08" y="73.5784">
<point/>
</object>
@ -31,4 +31,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="4" name="BLOCK" x="72.069" y="72.069">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="15">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="18">
<properties>
<property name="DIRECTIONS" value="DDDDRRRD"/>
<property name="ITEMS" value="BLOCK,BLOCK,SWITCH"/>
<property name="NAME" value="Try not to go too far"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,19,26,27,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="4" name="ICE" x="119.968" y="121.411">
<point/>
</object>
@ -46,4 +46,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="15" name="BLOCK" x="135.125" y="71.4972">
<point/>
</object>
<object id="16" name="SWITCH" x="136.025" y="102.299">
<point/>
</object>
<object id="17" name="BLOCK" x="54.185" y="120.511">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="11">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="12">
<properties>
<property name="DIRECTIONS" value="DRDRRDLRD"/>
<property name="ITEMS" value="BLOCK"/>
<property name="NAME" value="Hmmmmm"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="2" name="HERO" x="56.8918" y="56.0583">
<point/>
</object>
@ -40,4 +40,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="4" name="Solution">
<object id="11" name="BLOCK" x="72.3579" y="103.496">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="4">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="5">
<properties>
<property name="DIRECTIONS" value="RRRRRR"/>
<property name="ITEMS" value="KEY"/>
<property name="NAME" value="Keys open doors"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="134.443" y="72.9947">
<point/>
</object>
@ -31,4 +31,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="4" name="KEY" x="71.5373" y="71.5373">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="3">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="4">
<properties>
<property name="DIRECTIONS" value="DDDL"/>
<property name="ITEMS" value="DOOR"/>
<property name="NAME" value="You can't go through locked doors"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,3,9,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="87.5735" y="42.2091">
<point/>
</object>
@ -28,4 +28,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="3" name="DOOR" x="88.0459" y="84.148">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="5">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="6">
<properties>
<property name="DIRECTIONS" value="RRDURRRRR"/>
<property name="ITEMS" value="DOOR"/>
<property name="NAME" value="Keys open more than one door"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="55.3188" y="74.784">
<point/>
</object>
@ -34,4 +34,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="5" name="DOOR" x="87.8166" y="70.8494">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="4">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="5">
<properties>
<property name="DIRECTIONS" value="LLLLLLL"/>
<property name="ITEMS" value="SWORD"/>
<property name="NAME" value="You need a sword to kill slimes"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="134.575" y="71.8102">
<point/>
</object>
@ -31,4 +31,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="4" name="SWORD" x="103.408" y="69.4737">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="3">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="5">
<properties>
<property name="DIRECTIONS" value="LLRRRRR"/>
<property name="ITEMS" value="SLIME,SWORD"/>
<property name="NAME" value="It takes time to kill slimes"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="135.08" y="73.5784">
<point/>
</object>
@ -28,4 +28,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="3" name="SLIME" x="38.7493" y="72.6837">
<point/>
</object>
<object id="4" name="SWORD" x="53.8822" y="71.5373">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="7">
<properties>
<property name="DIRECTIONS" value="URULUUUUL"/>
<property name="ITEMS" value="DOOR"/>
<property name="NAME" value="You can only hold one item"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="103.958" y="123.868">
<point/>
</object>
@ -37,4 +37,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="6" name="DOOR" x="118.954" y="104.169">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="3">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="7">
<properties>
<property name="DIRECTIONS" value="RULDRULDRULD"/>
<property name="ITEMS" value="DOOR,SWORD,SLIME,SQUID_UP"/>
<property name="NAME" value="Now they're just going in circles"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,1,7,5,6,9,0,0,
0,0,1,4,1073741852,17,13,13,3221225500,9,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="72.9779" y="76.2911">
<point/>
</object>
@ -28,4 +28,18 @@
<point/>
</object>
</objectgroup>
<objectgroup id="4" name="Solution">
<object id="3" name="DOOR" x="72.3579" y="57.1247">
<point/>
</object>
<object id="4" name="SWORD" x="87.8152" y="55.5565">
<point/>
</object>
<object id="5" name="SLIME" x="86.9191" y="38.9792">
<point/>
</object>
<object id="6" name="SQUID_UP" x="86.023" y="119.178">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="8">
<properties>
<property name="DIRECTIONS" value="RRRRRRDDRR"/>
<property name="ITEMS" value="DOOR_SWITCHED_OPEN,SWITCH"/>
<property name="NAME" value="Be careful of the spikes"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="38.5701" y="73.6808">
<point/>
</object>
@ -37,4 +37,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="6" name="DOOR_SWITCHED_OPEN" x="119.178" y="74.1501">
<point/>
</object>
<object id="7" name="SWITCH" x="103.272" y="73.254">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="11">
<properties>
<property name="DIRECTIONS" value="ULULULULULULULUL"/>
<property name="ITEMS" value="DOOR_SWITCHED_OPEN,SWITCH,SWITCH,DOOR_SWITCHED"/>
<property name="NAME" value="Why do people leave things in awkward places?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="133.224" y="106.213">
<point/>
</object>
@ -40,4 +40,18 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="DOOR_SWITCHED_OPEN" x="119.85" y="71.6859">
<point/>
</object>
<object id="8" name="DOOR_SWITCHED" x="101.256" y="71.0138">
<point/>
</object>
<object id="9" name="SWITCH" x="118.73" y="84.6789">
<point/>
</object>
<object id="10" name="SWITCH" x="102.152" y="85.799">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="8">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="11">
<properties>
<property name="DIRECTIONS" value="RRRRRRRRRRRRRR"/>
<property name="ITEMS" value="DOOR,SQUID_DOWN,DOOR_SWITCHED,DOOR_SWITCHED_OPEN"/>
<property name="NAME" value="Why are they running right at it?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,1,8,4,1073741872,2,7,9,0,0,
0,0,37,15,15,1073741863,15,13,3221225500,3,9,
@ -20,7 +20,7 @@
0,0,0,0,0,19,21,22,23,27,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="39.5158" y="73.1744">
<point/>
</object>
@ -43,4 +43,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="8" name="SQUID_DOWN" x="136.427" y="55.3325">
<point/>
</object>
<object id="9" name="DOOR" x="135.755" y="120.074">
<point/>
</object>
<object id="10" name="DOOR_SWITCHED_OPEN" x="87.5912" y="72.5819">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="5">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="8">
<properties>
<property name="DIRECTIONS" value="RRRRRRRRR"/>
<property name="ITEMS" value="SWORD,SQUID_DOWN,HERO"/>
<property name="NAME" value="Squids keep stealing the treasure. Why did I put them here again?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,1,8,2,6,9,0,0,
0,0,0,0,46,11,11,11,38,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,19,23,27,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="DOOR" x="118.616" y="89.6423">
<point/>
</object>
@ -34,4 +34,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="4" name="Solution">
<object id="5" name="HERO" x="71.2378" y="86.023">
<point/>
</object>
<object id="6" name="SWORD" x="87.3671" y="86.6951">
<point/>
</object>
<object id="7" name="SQUID_DOWN" x="103.72" y="36.963">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="9">
<properties>
<property name="DIRECTIONS" value="DDDRRRR"/>
<property name="ITEMS" value="SQUID_DOWN,DOOR_SWITCHED_OPEN,DOOR_SWITCHED,KEY"/>
<property name="NAME" value="I'm sorry squid"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,1,5,9,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="70.8948" y="41.3376">
<point/>
</object>
@ -37,4 +37,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="6" name="SQUID_DOWN" x="70.5275" y="88.0051">
<point/>
</object>
<object id="7" name="DOOR_SWITCHED_OPEN" x="72.1724" y="102.399">
<point/>
</object>
<object id="8" name="KEY" x="72.3781" y="56.9566">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="12">
<properties>
<property name="DIRECTIONS" value="RDRDRDRRRDDDRR"/>
<property name="ITEMS" value="SWITCH,SWORD,DOOR,SLIME,SLIME"/>
<property name="NAME" value="The key is right there!"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,1,2,9,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="39.2614" y="90.2111">
<point/>
</object>
@ -40,4 +40,21 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="SWITCH" x="56.4526" y="105.961">
<point/>
</object>
<object id="8" name="SWORD" x="54.4365" y="90.5034">
<point/>
</object>
<object id="9" name="SLIME" x="71.4618" y="116.266">
<point/>
</object>
<object id="10" name="SLIME" x="88.9353" y="117.386">
<point/>
</object>
<object id="11" name="DOOR" x="105.065" y="89.3833">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="5">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="10">
<properties>
<property name="DIRECTIONS" value="DDDRRRRRRRRRRRRU"/>
<property name="ITEMS" value="SQUID_UP,SQUID_DOWN,SWITCH,SPIKES,DOOR,KEY"/>
<property name="NAME" value="We used to have treasure in there"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,1,4,8,3,2,3,9,0,
0,0,0,46,11,12,14,16,14,38,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="22.9531" y="73.3414">
<point/>
</object>
@ -34,4 +34,21 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="5" name="KEY" x="21.5058" y="84.4549">
<point/>
</object>
<object id="6" name="DOOR" x="135.307" y="103.048">
<point/>
</object>
<object id="7" name="SQUID_DOWN" x="88.4872" y="40.3233">
<point/>
</object>
<object id="8" name="SPIKES" x="86.6951" y="106.185">
<point/>
</object>
<object id="9" name="SWITCH" x="73.03" y="105.513">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="8">
<properties>
<property name="DIRECTIONS" value="RDDL"/>
<property name="ITEMS" value="DOOR_SWITCHED,DOOR_SWITCHED_OPEN"/>
<property name="NAME" value="Squids, they have a mind of their own"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,1,7,9,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="SQUID_DOWN" x="39.9103" y="42.1559">
<point/>
</object>
@ -37,4 +37,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="6" name="DOOR_SWITCHED" x="134.635" y="54.4365">
<point/>
</object>
<object id="7" name="DOOR_SWITCHED_OPEN" x="119.178" y="86.6951">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="9">
<properties>
<property name="DIRECTIONS" value="DDDRRRDDDLLL"/>
<property name="ITEMS" value="SWITCH,DOOR"/>
<property name="NAME" value="Why did I put that door there?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,1,8,9,0,0,0,0,0,
1,7,2,32,16,3221225500,9,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,19,23,25,48,22,27,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="DOOR_SWITCHED" x="70.8105" y="58.7495">
<point/>
</object>
@ -40,4 +40,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="SWITCH" x="22.4125" y="86.3602">
<point/>
</object>
<object id="8" name="DOOR" x="22.4125" y="39.4789">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="7">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="10">
<properties>
<property name="DIRECTIONS" value="RRDDRRRRRR"/>
<property name="ITEMS" value="KEY,SQUID_DOWN,SQUID_DOWN"/>
<property name="NAME" value="Why does no one look where they're going?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,3,7,6,9,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="40.9779" y="91.8723">
<point/>
</object>
@ -40,4 +40,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="SQUID_DOWN" x="86.6951" y="39.2032">
<point/>
</object>
<object id="8" name="SQUID_DOWN" x="118.954" y="39.2032">
<point/>
</object>
<object id="9" name="KEY" x="87.8152" y="56.2286">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="10">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="13">
<properties>
<property name="DIRECTIONS" value="RRRRRRRRRRRRRRR"/>
<property name="ITEMS" value="SWITCH,SWITCH,SWITCH,DOOR_SWITCHED,DOOR_SWITCHED_OPEN,SQUID_UP,SQUID_UP,SQUID_DOWN,SQUID_DOWN"/>
<property name="NAME" value="DO I HAVE TO DO EVERYTHING?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,1,4,3221225492,7,2147483655,3,1073741844,1073741850,2147483649,0,
0,37,2147483659,11,2147483659,2147483665,3221225486,3221225484,1073741839,3221225518,0,
@ -20,7 +20,7 @@
19,2147483672,2147483673,1073741831,1073741832,1073741829,21,1073741826,22,22,27
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="151.602" y="138.188">
<point/>
</object>
@ -49,4 +49,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="10" name="SQUID_UP" x="38.2908" y="43.7936">
<point/>
</object>
<object id="11" name="SWITCH" x="39.8958" y="26.8265">
<point/>
</object>
<object id="12" name="SWITCH" x="41.0422" y="85.9823">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="5">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="6">
<properties>
<property name="DIRECTIONS" value="RLRRRD"/>
<property name="ITEMS" value="DOOR_SWITCHED"/>
<property name="NAME" value="Switches toggle things"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="72.4717" y="58.9704">
<point/>
</object>
@ -34,4 +34,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="5" name="DOOR_SWITCHED" x="87.8166" y="56.6337">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="9">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="19">
<properties>
<property name="DIRECTIONS" value="RRRRRRRRRRRRRRRR"/>
<property name="ITEMS" value="DOOR,DOOR,DOOR,DOOR"/>
<property name="NAME" value="There's no way through without a little help"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
1,6,7,7,4,5,3,2,4,7,9,
37,12,14,13,12,15,12,16,14,13,47,
@ -20,7 +20,7 @@
19,23,24,26,22,20,24,25,26,25,27
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="3" name="HERO" x="38.75" y="23.5">
<point/>
</object>
@ -40,4 +40,18 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution" visible="0">
<object id="15" name="DOOR" x="121.25" y="74.5">
<point/>
</object>
<object id="16" name="DOOR" x="88.75" y="72.75">
<point/>
</object>
<object id="17" name="DOOR" x="104.5" y="121.25">
<point/>
</object>
<object id="18" name="DOOR" x="38" y="106">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="10">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="12">
<properties>
<property name="DIRECTIONS" value="RRRRRRRRUUUUUUUU"/>
<property name="ITEMS" value="DOOR,SWITCH"/>
<property name="NAME" value="How many floors like this are there?"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,1,6,8,5,4,9,
0,0,1,7,8,32,11,17,12,17,38,
@ -20,7 +20,7 @@
19,26,20,21,25,20,22,24,21,24,27
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="3" name="HERO" x="24.9004" y="137.709">
<point/>
</object>
@ -37,4 +37,12 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="10" name="SWITCH" x="56.25" y="87.5">
<point/>
</object>
<object id="11" name="DOOR" x="86.5" y="88.25">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="14">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="15">
<properties>
<property name="DIRECTIONS" value="UULDLDDDDRDRRRD"/>
<property name="ITEMS" value="SWITCH"/>
<property name="NAME" value="There's no way through without a little help"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,1,8,3,9,1,7,9,0,0,0,
1,1073741852,11,11,3221225500,1073741852,13,38,0,0,0,
@ -20,7 +20,7 @@
0,0,0,19,20,24,21,27,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="9" name="ROTATOR_UP" x="135.75" y="119.5">
<point/>
</object>
@ -37,4 +37,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="14" name="SWITCH" x="103.25" y="88">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="8">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="12">
<properties>
<property name="DIRECTIONS" value="UUULLLD"/>
<property name="ITEMS" value="TELEPORTER,TELEPORTER,SQUID_UP,SWITCH"/>
<property name="NAME" value="Hmmmmmmmmmm"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,1,6,4,3,9,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,19,22,22,27,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="STAIRS" x="70.4375" y="75.2306">
<point/>
</object>
@ -40,4 +40,18 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="8" name="SQUID_UP" x="102.6" y="71.6859">
<point/>
</object>
<object id="9" name="TELEPORTER" x="102.152" y="40.9954">
<point/>
</object>
<object id="10" name="TELEPORTER" x="70.5658" y="36.515">
<point/>
</object>
<object id="11" name="SWITCH" x="116.714" y="55.1085">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="8">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="11">
<properties>
<property name="DIRECTIONS" value="RRRRD"/>
<property name="ITEMS" value="DOOR_SWITCHED_OPEN,SQUID_DOWN,BLOCK"/>
<property name="NAME" value="Hmmmm"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="HERO" x="56.8918" y="88.5679">
<point/>
</object>
@ -34,4 +34,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="8" name="DOOR_SWITCHED_OPEN" x="119.229" y="88.5044">
<point/>
</object>
<object id="9" name="BLOCK" x="134.362" y="86.4409">
<point/>
</object>
<object id="10" name="SQUID_DOWN" x="133.215" y="71.0787">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="8">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="11">
<properties>
<property name="DIRECTIONS" value="ULLDDLD"/>
<property name="ITEMS" value="BLOCK,BLOCK,GLOVE"/>
<property name="NAME" value="Hmmmmmmmm"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
1,7,4,2,6,9,0,1,8,9,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="1" name="SQUID_UP" x="136.499" y="88.7763">
<point/>
</object>
@ -43,4 +43,15 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="8" name="BLOCK" x="136.196" y="71.5373">
<point/>
</object>
<object id="9" name="GLOVE" x="57.7801" y="39.8958">
<point/>
</object>
<object id="10" name="BLOCK" x="38.9786" y="55.9458">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="6">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="8">
<properties>
<property name="DIRECTIONS" value="RRRDRRRR"/>
<property name="ITEMS" value="TELEPORTER"/>
<property name="NAME" value="They say you can't remember moving"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,
0,1,4,5,4,3,7,2,8,9,0,
@ -20,7 +20,7 @@
0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="3" name="HERO" x="39.3333" y="40.3333">
<point/>
</object>
@ -31,4 +31,9 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="7" name="TELEPORTER" x="87" y="39.6667">
<point/>
</object>
</objectgroup>
</map>

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="13">
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="11" height="10" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="19">
<properties>
<property name="DIRECTIONS" value="RRRRDDDDDDDD"/>
<property name="ITEMS" value="BLOCK,BLOCK,SQUID_DOWN,TELEPORTER,TELEPORTER,GLOVE"/>
<property name="NAME" value="The hero is rather useless without help"/>
</properties>
<tileset firstgid="1" source="../level16.tsx"/>
<layer id="1" name="Tile Layer 1" width="11" height="10">
<layer id="1" name="Ground" width="11" height="10">
<data encoding="csv">
0,0,1,8,7,7,5,9,0,0,0,
1,6,1073741852,15,16,15,13,3221225500,9,0,0,
@ -20,7 +20,7 @@
0,0,0,0,19,23,27,0,0,0,0
</data>
</layer>
<objectgroup id="2" name="Object Layer 1">
<objectgroup id="2" name="Puzzle">
<object id="3" name="HERO" x="23.6165" y="40.8129">
<point/>
</object>
@ -43,4 +43,24 @@
<point/>
</object>
</objectgroup>
<objectgroup id="3" name="Solution">
<object id="13" name="SQUID_DOWN" x="55.4872" y="23.8458">
<point/>
</object>
<object id="14" name="TELEPORTER" x="54.7994" y="56.1751">
<point/>
</object>
<object id="15" name="TELEPORTER" x="86.6701" y="87.1287">
<point/>
</object>
<object id="16" name="GLOVE" x="38.2908" y="39.2079">
<point/>
</object>
<object id="17" name="BLOCK" x="89.8801" y="40.1251">
<point/>
</object>
<object id="18" name="BLOCK" x="88.0459" y="56.6337">
<point/>
</object>
</objectgroup>
</map>

View file

@ -11,7 +11,7 @@ use crate::{
use self::{
animation::{Animation, RenderCache},
entity::{Action, EntityMap},
entity::{Action, EntityMap, EntityMapMaker},
};
mod animation;
@ -33,19 +33,21 @@ pub struct Simulation {
impl Simulation {
pub fn generate(
a: impl Iterator<Item = (Item, Vector2D<i32>)>,
entities_to_add: impl Iterator<Item = (Item, Vector2D<i32>)>,
level: &'static Level,
sfx: &mut Sfx,
loader: &mut SpriteLoader,
) -> Simulation {
let mut entities = EntityMap::default();
let mut entities = EntityMapMaker::new();
let mut animation = Animation::default();
let mut entities_to_add: Vec<_> = a.collect();
entities_to_add.sort_unstable_by_key(|(_, location)| location.x + location.y * 100);
for (item, location) in entities_to_add {
animation.populate(entities.add(item, location), sfx);
entities.add(item, location);
}
let (entities, animations) = entities.to_entity_map();
for ani in animations {
animation.populate(ani, sfx);
}
let mut simulation = Simulation {

View file

@ -18,11 +18,39 @@ use super::animation::AnimationInstruction;
new_key_type! { pub struct EntityKey; }
#[derive(Default)]
pub struct EntityMap {
map: SlotMap<EntityKey, Entity>,
}
pub struct EntityMapMaker {
map: Vec<(crate::level::Item, Vector2D<i32>)>,
}
impl EntityMapMaker {
pub fn new() -> Self {
Self {
map: Default::default(),
}
}
pub fn add(&mut self, entity: crate::level::Item, location: Vector2D<i32>) {
let idx = self.map.push((entity, location));
}
pub fn to_entity_map(mut self) -> (EntityMap, Vec<AnimationInstruction>) {
self.map
.sort_unstable_by_key(|(_, location)| location.x + location.y * 100);
let mut entity_map = EntityMap {
map: Default::default(),
};
let mut animations = Vec::new();
for (entity, location) in self.map {
animations.push(entity_map.add(entity, location));
}
(entity_map, animations)
}
}
#[derive(Clone, Copy, PartialEq, PartialOrd, Debug)]
pub enum Outcome {
Continue,
@ -1026,3 +1054,107 @@ impl From<level::Item> for EntityType {
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use agb::hash_map::HashMap;
#[test_case]
fn check_all_puzzle_solutions_work(_gba: &mut agb::Gba) {
let number_of_levels = crate::level::Level::num_levels();
let mut failed_levels = Vec::new();
#[derive(Debug)]
enum CompleteSimulationResult {
Success,
ExplicitLoss,
InputSequenceOver,
MismatchedItems(HashMap<crate::level::Item, ()>),
}
fn check_level_has_valid_items(level: usize) -> HashMap<crate::level::Item, ()> {
let level = crate::level::Level::get_level(level);
let mut given_items = HashMap::new();
for &item in level.items.iter() {
*given_items.entry(item).or_insert(0) += 1;
}
let mut solution_items = HashMap::new();
for entity in level.solution.iter() {
*solution_items.entry(entity.0).or_insert(0) += 1;
}
let mut mismatched = HashMap::new();
for (&item, &count) in solution_items.iter() {
if *given_items.entry(item).or_insert(0) < count {
mismatched.insert(item, ());
}
}
mismatched
}
fn check_level_works(level: usize) -> CompleteSimulationResult {
let level = crate::level::Level::get_level(level);
let mut simulator = EntityMapMaker::new();
for entity in level.entities {
simulator.add(entity.0, entity.1);
}
for solution_entity in level.solution {
simulator.add(solution_entity.0, solution_entity.1);
}
let (mut simulator, _) = simulator.to_entity_map();
for &direction in level.directions {
let (outcome, _) = simulator.tick(&level.map, Action::Direction(direction));
match outcome {
Outcome::Continue => {}
Outcome::Loss => return CompleteSimulationResult::ExplicitLoss,
Outcome::Win => return CompleteSimulationResult::Success,
}
}
CompleteSimulationResult::InputSequenceOver
}
for level_idx in 0..number_of_levels {
let mismatched_items = check_level_has_valid_items(level_idx);
if !mismatched_items.is_empty() {
failed_levels.push((
level_idx,
CompleteSimulationResult::MismatchedItems(mismatched_items),
))
}
let outcome = check_level_works(level_idx);
match outcome {
CompleteSimulationResult::ExplicitLoss
| CompleteSimulationResult::InputSequenceOver => {
failed_levels.push((level_idx, outcome))
}
_ => {}
}
}
if !failed_levels.is_empty() {
agb::println!("Levels that failed were:");
for (level, outcome) in failed_levels {
agb::println!(
"Level: {}, reason {:?}, lament: {}",
level,
outcome,
crate::level::Level::get_level(level).name
);
}
panic!("Level check failed");
}
}
}

View file

@ -2,7 +2,7 @@ use agb::{display::object::Tag, fixnum::Vector2D};
use crate::{game::Direction, map::Map, resources};
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub enum Item {
Sword,
Slime,
@ -123,15 +123,19 @@ pub struct Entity(pub Item, pub Vector2D<i32>);
pub struct Level {
pub map: Map<'static>,
pub entities: &'static [Entity],
#[cfg(test)]
pub solution: &'static [Entity],
pub directions: &'static [Direction],
pub items: &'static [Item],
pub name: &'static str,
}
impl Level {
#[allow(unused_variables)]
const fn new(
map: Map<'static>,
entities: &'static [Entity],
solution: &'static [Entity],
directions: &'static [Direction],
items: &'static [Item],
name: &'static str,
@ -139,6 +143,8 @@ impl Level {
Self {
map,
entities,
#[cfg(test)]
solution,
directions,
items,
name,

View file

@ -22,7 +22,7 @@ impl<'map> Map<'map> {
pub const fn get(&self, index: Vector2D<i32>) -> MapElement {
let (x, y) = (index.x, index.y);
if x > self.width as i32 || y > self.height as i32 {
if x > self.width as i32 || x < 0 || y > self.height as i32 || y < 0 {
MapElement::Wall
} else {
let position = x as usize + y as usize * self.width;