diff --git a/public/exports/maps/map_realtor.png b/public/exports/maps/map_realtor.png new file mode 100644 index 00000000..f2ed7a9e Binary files /dev/null and b/public/exports/maps/map_realtor.png differ diff --git a/public/maps/map_realtor.json b/public/maps/map_realtor.json new file mode 100644 index 00000000..0a88034b --- /dev/null +++ b/public/maps/map_realtor.json @@ -0,0 +1,999 @@ +{ "compressionlevel":-1, + "height":20, + "infinite":false, + "layers":[ + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, + 0, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 0, + 0, 15, 16, 15, 16, 15, 16, 15, 16, 15, 16, 15, 16, 15, 16, 15, 16, 15, 16, 0, + 0, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 0, + 0, 17, 17, 17, 17, 17, 17, 17, 26, 27, 26, 27, 17, 17, 17, 17, 17, 17, 17, 0], + "height":20, + "id":1, + "name":"ground", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":20, + "x":0, + "y":0 + }, + { + "data":[35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 38, + 67, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 119, 120, 84, 120, 85, 46, + 67, 0, 0, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 0, 135, 136, 137, 137, 137, 54, + 94, 84, 84, 84, 84, 84, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, + 67, 136, 136, 136, 136, 136, 138, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, 120, 120, 120, 120, 120, 120, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 136, 136, 136, 136, 136, 136, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, + 94, 84, 84, 120, 122, 0, 119, 120, 120, 120, 120, 120, 120, 120, 120, 37, 37, 120, 120, 46, + 67, 136, 136, 136, 138, 0, 135, 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, 136, 136, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, + 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, + 83, 84, 84, 84, 84, 84, 84, 84, 122, 0, 0, 119, 85, 85, 85, 85, 85, 85, 85, 86], + "height":20, + "id":3, + "name":"walls", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":20, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 152, 37, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 136, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1340, 1266, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1267, 1303, 0, + 0, 172, 1750, 1751, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 172, 1756, 1757, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 162, 161, 162, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 161, 162, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 162, 161, 162, 161, 162, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":20, + "id":4, + "name":"objects", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":20, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":6, + "name":"copmuters", + "objects":[ + { + "gid":158, + "height":16, + "id":1, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":176 + }, + { + "gid":158, + "height":16, + "id":2, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":216, + "y":176 + }, + { + "gid":158, + "height":16, + "id":3, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":176 + }, + { + "gid":158, + "height":16, + "id":4, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":40, + "y":128 + }, + { + "gid":158, + "height":16, + "id":5, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":72, + "y":128 + }, + { + "gid":158, + "height":16, + "id":6, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":96 + }, + { + "gid":158, + "height":16, + "id":7, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":96 + }, + { + "gid":148, + "height":16, + "id":10, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":80 + }, + { + "gid":148, + "height":16, + "id":11, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":80 + }, + { + "gid":148, + "height":16, + "id":12, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":216, + "y":160 + }, + { + "gid":148, + "height":16, + "id":13, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":160 + }, + { + "gid":148, + "height":16, + "id":14, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":160 + }, + { + "gid":148, + "height":16, + "id":15, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":72, + "y":112 + }, + { + "gid":148, + "height":16, + "id":16, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":40, + "y":112 + }, + { + "gid":1868, + "height":16, + "id":32, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":48, + "y":40 + }, + { + "gid":1867, + "height":16, + "id":33, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":32, + "y":40 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":7, + "name":"chairs", + "objects":[ + { + "gid":170, + "height":16, + "id":17, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":96 + }, + { + "gid":170, + "height":16, + "id":18, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":96 + }, + { + "gid":170, + "height":16, + "id":19, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":72, + "y":128 + }, + { + "gid":170, + "height":16, + "id":20, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":40, + "y":128 + }, + { + "gid":170, + "height":16, + "id":21, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":216, + "y":176 + }, + { + "gid":170, + "height":16, + "id":22, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":176 + }, + { + "gid":170, + "height":16, + "id":23, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":176 + }, + { + "gid":566, + "height":16, + "id":24, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":16, + "y":288 + }, + { + "gid":566, + "height":16, + "id":25, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":16, + "y":304 + }, + { + "gid":593, + "height":16, + "id":26, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":32, + "y":272 + }, + { + "gid":593, + "height":16, + "id":27, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":48, + "y":272 + }, + { + "gid":593, + "height":16, + "id":28, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":112, + "y":272 + }, + { + "gid":593, + "height":16, + "id":29, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":144, + "y":272 + }, + { + "gid":593, + "height":16, + "id":30, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":176, + "y":272 + }, + { + "gid":593, + "height":16, + "id":31, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":208, + "y":272 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":8, + "name":"spawnpoints", + "objects":[ + { + "height":0, + "id":34, + "name":"player", + "point":true, + "rotation":0, + "type":"", + "visible":true, + "width":0, + "x":160, + "y":288 + }, + { + "height":0, + "id":35, + "name":"clerk", + "point":true, + "rotation":0, + "type":"", + "visible":true, + "width":0, + "x":256, + "y":240 + }], + "opacity":1, + "properties":[ + { + "name":"isStatic", + "type":"bool", + "value":false + }], + "type":"objectgroup", + "visible":false, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":9, + "name":"interaction_objects", + "objects":[ + { + "height":32, + "id":36, + "name":"fridge", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":16, + "y":16 + }, + { + "height":16, + "id":37, + "name":"computer_1", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":40, + "y":104 + }, + { + "height":16, + "id":38, + "name":"computer_2", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":72, + "y":104 + }, + { + "height":16, + "id":39, + "name":"computer_1", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":72 + }, + { + "height":16, + "id":40, + "name":"computer_2", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":72 + }, + { + "height":16, + "id":41, + "name":"computer_1", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":216, + "y":152 + }, + { + "height":16, + "id":42, + "name":"computer_2", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":152 + }, + { + "height":16, + "id":43, + "name":"computer_1", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":280, + "y":152 + }, + { + "height":32, + "id":44, + "name":"boxes", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":272, + "y":32 + }, + { + "height":24, + "id":65, + "name":"counter_clerk", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":240, + "y":240 + }, + { + "height":16, + "id":66, + "name":"behind_desk", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":248, + "y":216 + }], + "opacity":1, + "properties":[ + { + "name":"isStatic", + "type":"bool", + "value":true + }], + "type":"objectgroup", + "visible":false, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":10, + "name":"enter_new_map_boundaries", + "objects":[ + { + "height":4, + "id":45, + "name":"enter_map_extended_campus", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":128, + "y":308 + }], + "opacity":1, + "properties":[ + { + "name":"isStatic", + "type":"bool", + "value":false + }], + "type":"objectgroup", + "visible":false, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":11, + "name":"map_boundaries", + "objects":[ + { + "height":8, + "id":46, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":320, + "x":0, + "y":312 + }, + { + "height":320, + "id":47, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":0, + "y":0 + }, + { + "height":24, + "id":48, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":320, + "x":0, + "y":0 + }, + { + "height":320, + "id":49, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":304, + "y":0 + }], + "opacity":1, + "properties":[ + { + "name":"isStatic", + "type":"bool", + "value":true + }], + "type":"objectgroup", + "visible":false, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":12, + "name":"building_boundaries", + "objects":[ + { + "height":24, + "id":50, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":48, + "x":16, + "y":16 + }, + { + "height":8, + "id":51, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":86, + "x":16, + "y":96 + }, + { + "height":12, + "id":52, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":32, + "y":104 + }, + { + "height":16, + "id":53, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":16, + "x":16, + "y":96 + }, + { + "height":8, + "id":54, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":90, + "x":234, + "y":64 + }, + { + "height":32, + "id":55, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":24, + "x":280, + "y":32 + }, + { + "height":32, + "id":56, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":32, + "y":64 + }, + { + "height":96, + "id":57, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":8, + "x":200, + "y":124 + }, + { + "height":16, + "id":58, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":128, + "x":200, + "y":144 + }, + { + "height":20, + "id":59, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":64, + "x":240, + "y":64 + }, + { + "height":20, + "id":60, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":96, + "x":208, + "y":144 + }, + { + "height":16, + "id":67, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":54, + "x":16, + "y":240 + }, + { + "height":16, + "id":68, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":136, + "x":106, + "y":240 + }, + { + "height":16, + "id":69, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":272, + "y":240 + }, + { + "height":8, + "id":70, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":32, + "x":240, + "y":248 + }, + { + "height":16, + "id":71, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":112, + "x":16, + "y":304 + }, + { + "height":16, + "id":72, + "name":"", + "rotation":0, + "type":"", + "visible":true, + "width":128, + "x":192, + "y":304 + }], + "opacity":1, + "properties":[ + { + "name":"isStatic", + "type":"bool", + "value":true + }], + "type":"objectgroup", + "visible":false, + "x":0, + "y":0 + }], + "nextlayerid":13, + "nextobjectid":73, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"1.11.0", + "tileheight":16, + "tilesets":[ + { + "firstgid":1, + "source":"..\/..\/..\/..\/..\/Tiled\/tilesets\/Little_Bits_Office_Floors.tsx" + }, + { + "firstgid":34, + "source":"..\/..\/..\/..\/..\/Tiled\/tilesets\/Little_Bits_office_walls.tsx" + }, + { + "firstgid":146, + "source":"..\/..\/..\/..\/..\/Tiled\/tilesets\/Little_Bits_office_objects.tsx" + }, + { + "firstgid":212, + "source":"..\/..\/..\/..\/..\/Tiled\/tilesets\/city_tiles.tsx" + }, + { + "firstgid":698, + "source":"..\/..\/..\/..\/..\/Tiled\/tilesets\/map_city.tsx" + }, + { + "firstgid":1734, + "source":"..\/..\/..\/..\/..\/Tiled\/tilesets\/furniture.tsx" + }], + "tilewidth":16, + "type":"map", + "version":"1.10", + "width":20 +} \ No newline at end of file diff --git a/src/gameObjects/map_realtor/clerk.gameObjects.js b/src/gameObjects/map_realtor/clerk.gameObjects.js new file mode 100644 index 00000000..fc375e63 --- /dev/null +++ b/src/gameObjects/map_realtor/clerk.gameObjects.js @@ -0,0 +1,31 @@ +import { scaleFactor } from '../../constants'; + +export const clerk = (k, map, spawnpoints) => { + k.loadSprite('clerk', './assets/sprites/characters.png', { + sliceX: 10, + sliceY: 20, + anims: { + 'idle-down': 160, + 'walk-down': { from: 184, to: 185, loop: true, speed: 4 }, + 'idle-side': 52, + 'walk-side': { from: 188, to: 190, loop: true, speed: 4 }, + 'idle-up': 181, + 'walk-up': { from: 186, to: 199, loop: true, speed: 4 }, + }, + }); + + return k.make([ + k.sprite('clerk', { anim: 'idle-down' }), + k.area({ + shape: new k.Rect(k.vec2(0), 16, 16), + }), + k.body({ isStatic: true }), + k.anchor('center'), + k.pos( + map.pos.x + spawnpoints.clerk.x / scaleFactor, + map.pos.y + spawnpoints.clerk.y / scaleFactor + ), + k.offscreen({ hide: true, distance: 10 }), + 'clerk', + ]); +}; diff --git a/src/gameObjects/map_realtor/index.js b/src/gameObjects/map_realtor/index.js new file mode 100644 index 00000000..f04e0912 --- /dev/null +++ b/src/gameObjects/map_realtor/index.js @@ -0,0 +1,5 @@ +import { clerk } from './clerk.gameObjects'; + +const gameObjects = [clerk]; + +export default gameObjects; diff --git a/src/interactions/map_extended_campus/enterMapRealtor.interactions.js b/src/interactions/map_extended_campus/enterMapRealtor.interactions.js new file mode 100644 index 00000000..36a1da06 --- /dev/null +++ b/src/interactions/map_extended_campus/enterMapRealtor.interactions.js @@ -0,0 +1,5 @@ +export const enterMapRealtor = (player, k) => { + player.onCollide('enter_map_realtor_office', () => { + k.go('realtor'); + }); +}; diff --git a/src/interactions/map_extended_campus/index.js b/src/interactions/map_extended_campus/index.js index 16366c57..9a0141d9 100644 --- a/src/interactions/map_extended_campus/index.js +++ b/src/interactions/map_extended_campus/index.js @@ -1,5 +1,6 @@ import { enterMapCityLeft } from './enterMapCityLeft.interactions'; import { enterMapCityTop } from './enterMapCityTop.interactions'; +import { enterMapRealtor } from './enterMapRealtor.interactions'; import { campusTreeInteraction } from './campusTreeInteraction.interactions'; import { fountainInteraction } from './fountainInteraction.interactions'; import { signLeftInteraction } from './signLeftInteraction.interactions'; @@ -9,6 +10,7 @@ import { treeSignInteraction } from './treeSignInteraction.interactions'; const interactions = [ enterMapCityLeft, enterMapCityTop, + enterMapRealtor, campusTreeInteraction, fountainInteraction, signLeftInteraction, diff --git a/src/interactions/map_realtor/behindDeskClerkInteraction.interactions.js b/src/interactions/map_realtor/behindDeskClerkInteraction.interactions.js new file mode 100644 index 00000000..4a95459b --- /dev/null +++ b/src/interactions/map_realtor/behindDeskClerkInteraction.interactions.js @@ -0,0 +1,15 @@ +import { interactionHandler } from '../handler.interactions'; +import { displayDialogue } from '../../utils'; + +export const behindDeskClerkInteraction = (player, k) => { + interactionHandler(player, 'behind_desk', k, async () => { + displayDialogue({ + k, + player, + text: [ + "Uhh... You aren't supposed to be behind here", + 'Get out dude', + ], + }); + }); +}; diff --git a/src/interactions/map_realtor/boxesInteraction.interactions.js b/src/interactions/map_realtor/boxesInteraction.interactions.js new file mode 100644 index 00000000..a5d1564e --- /dev/null +++ b/src/interactions/map_realtor/boxesInteraction.interactions.js @@ -0,0 +1,14 @@ +import { interactionHandler } from '../handler.interactions'; +import { displayDialogue } from '../../utils'; + +export const boxesInteraction = (player, k) => { + interactionHandler(player, 'boxes', k, async () => { + displayDialogue({ + k, + player, + text: [ + 'Bunch of boxes here... nothing to see (Just an Xbox One laying in the corner hehehe)', + ], + }); + }); +}; diff --git a/src/interactions/map_realtor/computerOneInteraction.interactions.js b/src/interactions/map_realtor/computerOneInteraction.interactions.js new file mode 100644 index 00000000..20355f65 --- /dev/null +++ b/src/interactions/map_realtor/computerOneInteraction.interactions.js @@ -0,0 +1,15 @@ +import { interactionHandler } from '../handler.interactions'; +import { displayDialogue } from '../../utils'; + +export const computerOneInteraction = (player, k) => { + interactionHandler(player, 'computer_1', k, async () => { + displayDialogue({ + k, + player, + text: [ + 'You currently see nothing that you understand what so ever on this computer', + 'It looks like so techy that you question your life choices', + ], + }); + }); +}; diff --git a/src/interactions/map_realtor/computerTwoInteraction.interactions.js b/src/interactions/map_realtor/computerTwoInteraction.interactions.js new file mode 100644 index 00000000..d36f85a3 --- /dev/null +++ b/src/interactions/map_realtor/computerTwoInteraction.interactions.js @@ -0,0 +1,16 @@ +import { interactionHandler } from '../handler.interactions'; +import { displayDialogue } from '../../utils'; + +export const computerTwoInteraction = (player, k) => { + interactionHandler(player, 'computer_2', k, async () => { + displayDialogue({ + k, + player, + text: [ + 'You see "Hello, world!" printed on the screen in C++', + "You think to yourself, wasn't the other screen way more complex?", + "What's going on here?", + ], + }); + }); +}; diff --git a/src/interactions/map_realtor/counterClerkInteraction.interactions.js b/src/interactions/map_realtor/counterClerkInteraction.interactions.js new file mode 100644 index 00000000..61f39380 --- /dev/null +++ b/src/interactions/map_realtor/counterClerkInteraction.interactions.js @@ -0,0 +1,135 @@ +import { interactionHandler } from '../handler.interactions'; +import { displayDialogue, displayPermissionBox } from '../../utils'; +import { + completeQuest, + completeQuestObjective, + recieveQuest, +} from '../../utils/questHandler'; +import { map_realtor } from '../quests/constants.quests'; + +export const counterClerkInteraction = (player, k) => { + interactionHandler(player, 'counter_clerk', k, async () => { + await displayDialogue({ + k, + player, + characterName: 'Realtor Clerk', + text: [ + 'Hello, we are a firm that gives out houses to residents attending Zero To Mastery.', + 'Would you like to purchase a house?', + ], + }); + recieveQuest(player, map_realtor['Buy a house!']); + completeQuestObjective( + player, + 'Buy a house!', + 'hasTalkedToRealtorClerk' + ); + const answer = await displayPermissionBox({ k, player, text: [''] }); + if (answer) { + showCustomPrompt( + 'Which house would you like to buy?', + ['Orange House', 'Red House', "Neither, I've changed my mind"], + (selectedOption) => { + if (!selectedOption.split(' ').includes('House')) { + displayDialogue({ + k, + player, + characterName: 'Realtor Clerk', + text: [ + "Okay, well let me know if you change your mind and we'll see if we can set you up!", + ], + }); + return; + } + if (player.state.coinsCollected >= 100) { + displayDialogue({ + k, + player, + characterName: 'Realtor Clerk', + text: [ + 'Congratulations!', + `You now own the ${selectedOption}!`, + ], + onDisplayEnd: () => { + completeQuestObjective( + player, + 'Buy a house!', + 'hasBoughtHouse' + ); + completeQuest(player, 'Buy a house!'); + }, + }); + } else { + displayDialogue({ + k, + player, + characterName: 'Realtor Clerk', + text: [ + "Oooooof, I'm sorry.", + "It looks like you don't have enough coins for the house...", + ], + }); + } + } + ); + } else { + await displayDialogue({ + k, + player, + characterName: 'Realtor Clerk', + text: [ + "Okay, well let me know if you change your mind and we'll see if we can set you up!", + ], + }); + } + }); +}; + +function showCustomPrompt(message, options, callback) { + // Set the prompt message + document.getElementById('prompt-message').textContent = message; + + // Clear any existing options in the container + const optionsContainer = document.getElementById('options-container'); + optionsContainer.innerHTML = ''; + + // Create buttons for each option + options.forEach((option) => { + const button = document.createElement('button'); + button.textContent = option; + button.classList.add('option-btn'); + button.setAttribute('tabindex', '0'); // Make the button focusable + + // Add click event for mouse interactions + button.onclick = function () { + callback(option); + closeCustomPrompt(); + }; + + // Add keyboard event listener for accessibility + button.addEventListener('keydown', function (e) { + if (e.key === 'Enter' || e.key === ' ') { + // Enter or Space key + e.preventDefault(); // Prevent the default behavior (e.g., form submission) + callback(option); + closeCustomPrompt(); + } + }); + + optionsContainer.appendChild(button); + }); + + // Display the custom prompt + document.getElementById('custom-prompt').style.display = 'flex'; + + // Set focus on the first button + if (optionsContainer.children.length > 0) { + optionsContainer.children[0].focus(); + } +} + +// Function to close the custom prompt +function closeCustomPrompt() { + // Hide the custom prompt + document.getElementById('custom-prompt').style.display = 'none'; +} diff --git a/src/interactions/map_realtor/enterMapExtendedCampus.interactions.js b/src/interactions/map_realtor/enterMapExtendedCampus.interactions.js new file mode 100644 index 00000000..481d7a89 --- /dev/null +++ b/src/interactions/map_realtor/enterMapExtendedCampus.interactions.js @@ -0,0 +1,5 @@ +export const enterMapExtendedCampus = (player, k) => { + player.onCollide('enter_map_extended_campus', () => { + k.go('extended_campus', 'spawn_realtor_office'); + }); +}; diff --git a/src/interactions/map_realtor/fridgeInteraction.interactions.js b/src/interactions/map_realtor/fridgeInteraction.interactions.js new file mode 100644 index 00000000..749c1841 --- /dev/null +++ b/src/interactions/map_realtor/fridgeInteraction.interactions.js @@ -0,0 +1,14 @@ +import { interactionHandler } from '../handler.interactions'; +import { displayDialogue } from '../../utils'; + +export const fridgeInteraction = (player, k) => { + interactionHandler(player, 'fridge', k, async () => { + displayDialogue({ + k, + player, + text: [ + 'No, you cannot go looking for food here, this is for employees only...', + ], + }); + }); +}; diff --git a/src/interactions/map_realtor/index.js b/src/interactions/map_realtor/index.js new file mode 100644 index 00000000..5f517329 --- /dev/null +++ b/src/interactions/map_realtor/index.js @@ -0,0 +1,19 @@ +import { behindDeskClerkInteraction } from './behindDeskClerkInteraction.interactions'; +import { boxesInteraction } from './boxesInteraction.interactions'; +import { computerOneInteraction } from './computerOneInteraction.interactions'; +import { computerTwoInteraction } from './computerTwoInteraction.interactions'; +import { fridgeInteraction } from './fridgeInteraction.interactions'; +import { counterClerkInteraction } from './counterClerkInteraction.interactions'; +import { enterMapExtendedCampus } from './enterMapExtendedCampus.interactions'; + +const interactions = [ + enterMapExtendedCampus, + behindDeskClerkInteraction, + boxesInteraction, + computerOneInteraction, + computerTwoInteraction, + counterClerkInteraction, + fridgeInteraction, +]; + +export default interactions; diff --git a/src/interactions/quests/constants.quests.js b/src/interactions/quests/constants.quests.js index db129c28..eb24db27 100644 --- a/src/interactions/quests/constants.quests.js +++ b/src/interactions/quests/constants.quests.js @@ -21,3 +21,14 @@ export const map_start_quests = { } ), }; + +export const map_realtor = { + 'Buy a house!': makeQuest( + 'Buy a house!', + "Go to the realtor's office in the extended campus to buy a house!", + { + hasTalkedToRealtorClerk: false, + hasBoughtHouse: false, + } + ), +}; diff --git a/src/main.js b/src/main.js index e434376c..318b5f3c 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,7 @@ import { loseScreen } from './scenes/gameMachine/lose'; import { classroom } from './scenes/classroom'; import { seaside } from './scenes/seaside'; import { downtown } from './scenes/downtown'; +import { realtor } from './scenes/realtor'; import { extendedCampus } from './scenes/extended_campus'; k.scene('start', (enter_tag) => bootstrap(start, { enter_tag })); @@ -35,10 +36,11 @@ k.scene('campus_house_1', (enter_tag) => k.scene('classroom', (enter_tag) => bootstrap(classroom, { enter_tag })); k.scene('seaside', (enter_tag) => bootstrap(seaside, { enter_tag })); k.scene('downtown', (enter_tag) => bootstrap(downtown, { enter_tag })); +k.scene('fishing', (enter_tag) => miniGameBootstrap(fishing, { enter_tag })); k.scene('extended_campus', (enter_tag) => bootstrap(extendedCampus, { enter_tag }) ); -k.scene('fishing', (enter_tag) => miniGameBootstrap(fishing, { enter_tag })); +k.scene('realtor', (enter_tag) => bootstrap(realtor, { enter_tag })); // Game Machine Scenes k.scene('startScreen', gameStartScreen); diff --git a/src/scenes/realtor.js b/src/scenes/realtor.js new file mode 100644 index 00000000..7f78b740 --- /dev/null +++ b/src/scenes/realtor.js @@ -0,0 +1,22 @@ +import gameObjects from '../gameObjects/map_realtor'; +import { initMap } from '../init/map.init'; +import interactions from '../interactions/map_realtor'; + +export async function realtor() { + const objectConfig = { + static: [ + 'map_boundaries', + 'building_boundaries', + 'enter_new_map_boundaries', + ], + spawnpoints: ['spawnpoints'], + interactionObjects: ['interaction_objects'], + }; + const [map, spawnpoint] = await initMap( + objectConfig, + './exports/maps/map_realtor.png', + './maps/map_realtor.json' + ); + + return [map, spawnpoint, gameObjects, interactions]; +}