diff --git a/Cargo.toml b/Cargo.toml index 853d3d3..e7bbe5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ludum-dare-48" +name = "one-breath" version = "0.1.0" authors = ["Evan Pratten "] edition = "2018" diff --git a/assets/img/character/diveNormal.aseprite b/assets/img/character/diveNormal.aseprite new file mode 100644 index 0000000..49cf5d8 Binary files /dev/null and b/assets/img/character/diveNormal.aseprite differ diff --git a/assets/img/character/diveNormal.json b/assets/img/character/diveNormal.json new file mode 100644 index 0000000..0687c6a --- /dev/null +++ b/assets/img/character/diveNormal.json @@ -0,0 +1,82 @@ +{ "frames": { + "Sprite-0005 0.": { + "frame": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 1.": { + "frame": { "x": 11, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 2.": { + "frame": { "x": 22, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 3.": { + "frame": { "x": 33, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 4.": { + "frame": { "x": 44, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 5.": { + "frame": { "x": 55, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 6.": { + "frame": { "x": 66, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "Sprite-0005 7.": { + "frame": { "x": 77, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + } + }, + "meta": { + "app": "http://www.aseprite.org/", + "version": "1.2.27-x64", + "image": "diveNormal.png", + "format": "RGBA8888", + "size": { "w": 88, "h": 21 }, + "scale": "1", + "frameTags": [ + ], + "layers": [ + { "name": "Layer 1", "opacity": 255, "blendMode": "normal" } + ], + "slices": [ + ] + } +} diff --git a/assets/img/character/diveNormal.png b/assets/img/character/diveNormal.png new file mode 100644 index 0000000..acf7ee8 Binary files /dev/null and b/assets/img/character/diveNormal.png differ diff --git a/assets/img/character/diveStroke.aseprite b/assets/img/character/diveStroke.aseprite new file mode 100644 index 0000000..c923093 Binary files /dev/null and b/assets/img/character/diveStroke.aseprite differ diff --git a/assets/img/character/diveStroke.json b/assets/img/character/diveStroke.json new file mode 100644 index 0000000..0717420 --- /dev/null +++ b/assets/img/character/diveStroke.json @@ -0,0 +1,186 @@ +{ "frames": { + "diveStroke 0.aseprite": { + "frame": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 1.aseprite": { + "frame": { "x": 17, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 2.aseprite": { + "frame": { "x": 34, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 3.aseprite": { + "frame": { "x": 51, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 4.aseprite": { + "frame": { "x": 68, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 5.aseprite": { + "frame": { "x": 85, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 6.aseprite": { + "frame": { "x": 102, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 7.aseprite": { + "frame": { "x": 119, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 8.aseprite": { + "frame": { "x": 136, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 9.aseprite": { + "frame": { "x": 153, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 10.aseprite": { + "frame": { "x": 170, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 11.aseprite": { + "frame": { "x": 187, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 12.aseprite": { + "frame": { "x": 204, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 13.aseprite": { + "frame": { "x": 221, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 14.aseprite": { + "frame": { "x": 238, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 15.aseprite": { + "frame": { "x": 255, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 16.aseprite": { + "frame": { "x": 272, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 17.aseprite": { + "frame": { "x": 289, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 18.aseprite": { + "frame": { "x": 306, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 19.aseprite": { + "frame": { "x": 323, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + }, + "diveStroke 20.aseprite": { + "frame": { "x": 340, "y": 0, "w": 17, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 17, "h": 21 }, + "sourceSize": { "w": 17, "h": 21 }, + "duration": 75 + } + }, + "meta": { + "app": "http://www.aseprite.org/", + "version": "1.2.27-x64", + "image": "diveStroke.png", + "format": "RGBA8888", + "size": { "w": 357, "h": 21 }, + "scale": "1", + "frameTags": [ + ], + "layers": [ + { "name": "Layer 1", "opacity": 255, "blendMode": "normal" } + ], + "slices": [ + ] + } +} diff --git a/assets/img/character/diveStroke.png b/assets/img/character/diveStroke.png new file mode 100644 index 0000000..b9bcf67 Binary files /dev/null and b/assets/img/character/diveStroke.png differ diff --git a/assets/img/character/diveStrokeCharge.aseprite b/assets/img/character/diveStrokeCharge.aseprite new file mode 100644 index 0000000..49cf5d8 Binary files /dev/null and b/assets/img/character/diveStrokeCharge.aseprite differ diff --git a/assets/img/character/diveStrokeCharge.json b/assets/img/character/diveStrokeCharge.json new file mode 100644 index 0000000..383ff0f --- /dev/null +++ b/assets/img/character/diveStrokeCharge.json @@ -0,0 +1,50 @@ +{ "frames": { + "diveStroke 0.aseprite": { + "frame": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "diveStroke 1.aseprite": { + "frame": { "x": 11, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "diveStroke 2.aseprite": { + "frame": { "x": 22, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + }, + "diveStroke 3.aseprite": { + "frame": { "x": 33, "y": 0, "w": 11, "h": 21 }, + "rotated": false, + "trimmed": false, + "spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 21 }, + "sourceSize": { "w": 11, "h": 21 }, + "duration": 100 + } + }, + "meta": { + "app": "http://www.aseprite.org/", + "version": "1.2.27-x64", + "image": "diveStrokeCharge.png", + "format": "RGBA8888", + "size": { "w": 44, "h": 21 }, + "scale": "1", + "frameTags": [ + ], + "layers": [ + { "name": "Layer 1", "opacity": 255, "blendMode": "normal" } + ], + "slices": [ + ] + } +} diff --git a/assets/img/character/diveStrokeCharge.png b/assets/img/character/diveStrokeCharge.png new file mode 100644 index 0000000..dbb8c77 Binary files /dev/null and b/assets/img/character/diveStrokeCharge.png differ diff --git a/assets/img/character/walk1.png b/assets/img/character/walk1.png new file mode 100644 index 0000000..1b338fe Binary files /dev/null and b/assets/img/character/walk1.png differ diff --git a/assets/img/map/cave.json b/assets/img/map/cave.json new file mode 100644 index 0000000..3fdba6c --- /dev/null +++ b/assets/img/map/cave.json @@ -0,0 +1 @@ +[{"x":95,"y":25,"width":190,"height":50},{"x":500,"y":30,"width":440,"height":60},{"x":90,"y":80,"width":180,"height":60},{"x":305,"y":70,"width":10,"height":20},{"x":525,"y":65,"width":390,"height":10},{"x":530,"y":75,"width":380,"height":10},{"x":385,"y":85,"width":10,"height":10},{"x":435,"y":85,"width":30,"height":10},{"x":470,"y":85,"width":20,"height":10},{"x":615,"y":85,"width":210,"height":10},{"x":190,"y":95,"width":20,"height":10},{"x":435,"y":95,"width":10,"height":10},{"x":475,"y":100,"width":10,"height":20},{"x":525,"y":100,"width":10,"height":20},{"x":640,"y":95,"width":160,"height":10},{"x":200,"y":105,"width":20,"height":10},{"x":500,"y":105,"width":20,"height":10},{"x":575,"y":105,"width":30,"height":10},{"x":660,"y":105,"width":120,"height":10},{"x":75,"y":170,"width":150,"height":120},{"x":175,"y":120,"width":10,"height":20},{"x":205,"y":115,"width":10,"height":10},{"x":495,"y":120,"width":10,"height":20},{"x":520,"y":115,"width":20,"height":10},{"x":585,"y":130,"width":10,"height":40},{"x":665,"y":115,"width":110,"height":10},{"x":155,"y":125,"width":10,"height":10},{"x":190,"y":125,"width":20,"height":10},{"x":505,"y":130,"width":10,"height":20},{"x":525,"y":125,"width":10,"height":10},{"x":660,"y":125,"width":120,"height":10},{"x":185,"y":135,"width":50,"height":10},{"x":520,"y":135,"width":20,"height":10},{"x":595,"y":135,"width":10,"height":10},{"x":665,"y":135,"width":110,"height":10},{"x":155,"y":145,"width":10,"height":10},{"x":220,"y":145,"width":20,"height":10},{"x":670,"y":145,"width":100,"height":10},{"x":155,"y":155,"width":10,"height":10},{"x":190,"y":155,"width":40,"height":10},{"x":225,"y":155,"width":10,"height":10},{"x":355,"y":160,"width":10,"height":20},{"x":645,"y":155,"width":150,"height":10},{"x":200,"y":165,"width":100,"height":10},{"x":565,"y":170,"width":10,"height":20},{"x":600,"y":175,"width":20,"height":30},{"x":670,"y":165,"width":100,"height":10},{"x":210,"y":175,"width":120,"height":10},{"x":345,"y":175,"width":50,"height":10},{"x":415,"y":175,"width":10,"height":10},{"x":575,"y":180,"width":10,"height":20},{"x":665,"y":175,"width":110,"height":10},{"x":285,"y":185,"width":270,"height":10},{"x":545,"y":185,"width":30,"height":10},{"x":665,"y":185,"width":110,"height":10},{"x":295,"y":195,"width":290,"height":10},{"x":525,"y":195,"width":10,"height":10},{"x":630,"y":195,"width":180,"height":10},{"x":305,"y":205,"width":310,"height":10},{"x":545,"y":210,"width":10,"height":20},{"x":640,"y":205,"width":160,"height":10},{"x":185,"y":215,"width":70,"height":10},{"x":355,"y":215,"width":230,"height":10},{"x":555,"y":215,"width":10,"height":10},{"x":645,"y":215,"width":150,"height":10},{"x":160,"y":225,"width":20,"height":10},{"x":270,"y":225,"width":20,"height":10},{"x":380,"y":225,"width":180,"height":10},{"x":660,"y":225,"width":120,"height":10},{"x":70,"y":255,"width":140,"height":50},{"x":410,"y":235,"width":120,"height":10},{"x":665,"y":240,"width":110,"height":20},{"x":385,"y":245,"width":70,"height":10},{"x":590,"y":255,"width":20,"height":30},{"x":390,"y":255,"width":20,"height":10},{"x":670,"y":260,"width":100,"height":20},{"x":605,"y":265,"width":10,"height":10},{"x":655,"y":295,"width":130,"height":50},{"x":65,"y":285,"width":130,"height":10},{"x":60,"y":295,"width":120,"height":10},{"x":55,"y":305,"width":110,"height":10},{"x":410,"y":315,"width":20,"height":30},{"x":50,"y":365,"width":100,"height":110},{"x":510,"y":320,"width":40,"height":20},{"x":355,"y":325,"width":10,"height":10},{"x":650,"y":330,"width":140,"height":20},{"x":285,"y":335,"width":30,"height":10},{"x":380,"y":335,"width":100,"height":10},{"x":515,"y":350,"width":70,"height":40},{"x":340,"y":345,"width":160,"height":10},{"x":635,"y":345,"width":170,"height":10},{"x":335,"y":355,"width":170,"height":10},{"x":635,"y":355,"width":170,"height":10},{"x":330,"y":365,"width":180,"height":10},{"x":560,"y":370,"width":20,"height":20},{"x":650,"y":370,"width":140,"height":20},{"x":325,"y":375,"width":190,"height":10},{"x":485,"y":375,"width":10,"height":10},{"x":520,"y":375,"width":40,"height":10},{"x":285,"y":385,"width":110,"height":10},{"x":395,"y":385,"width":10,"height":10},{"x":515,"y":385,"width":10,"height":10},{"x":660,"y":395,"width":120,"height":30},{"x":105,"y":395,"width":10,"height":10},{"x":285,"y":400,"width":130,"height":20},{"x":580,"y":405,"width":20,"height":30},{"x":525,"y":405,"width":10,"height":10},{"x":170,"y":430,"width":20,"height":40},{"x":295,"y":425,"width":130,"height":30},{"x":520,"y":415,"width":20,"height":10},{"x":655,"y":415,"width":130,"height":10},{"x":45,"y":625,"width":90,"height":410},{"x":505,"y":425,"width":30,"height":10},{"x":650,"y":430,"width":140,"height":20},{"x":185,"y":435,"width":10,"height":10},{"x":375,"y":435,"width":30,"height":10},{"x":430,"y":435,"width":40,"height":10},{"x":495,"y":450,"width":10,"height":40},{"x":185,"y":445,"width":10,"height":10},{"x":245,"y":455,"width":30,"height":30},{"x":360,"y":445,"width":180,"height":10},{"x":530,"y":445,"width":20,"height":10},{"x":665,"y":445,"width":110,"height":10},{"x":180,"y":485,"width":20,"height":70},{"x":215,"y":460,"width":10,"height":20},{"x":305,"y":455,"width":90,"height":10},{"x":420,"y":455,"width":80,"height":10},{"x":535,"y":460,"width":10,"height":20},{"x":660,"y":465,"width":120,"height":30},{"x":305,"y":465,"width":90,"height":10},{"x":365,"y":470,"width":10,"height":20},{"x":385,"y":465,"width":10,"height":10},{"x":440,"y":470,"width":40,"height":20},{"x":505,"y":475,"width":10,"height":30},{"x":260,"y":475,"width":80,"height":10},{"x":330,"y":475,"width":40,"height":10},{"x":380,"y":475,"width":20,"height":10},{"x":520,"y":475,"width":20,"height":10},{"x":265,"y":485,"width":70,"height":10},{"x":315,"y":495,"width":10,"height":30},{"x":435,"y":485,"width":30,"height":10},{"x":515,"y":485,"width":10,"height":10},{"x":650,"y":485,"width":140,"height":10},{"x":265,"y":495,"width":50,"height":10},{"x":640,"y":505,"width":160,"height":30},{"x":195,"y":505,"width":10,"height":10},{"x":280,"y":510,"width":20,"height":20},{"x":195,"y":515,"width":10,"height":10},{"x":190,"y":535,"width":20,"height":30},{"x":580,"y":525,"width":20,"height":10},{"x":660,"y":535,"width":120,"height":30},{"x":575,"y":535,"width":10,"height":10},{"x":185,"y":555,"width":30,"height":10},{"x":320,"y":570,"width":20,"height":40},{"x":430,"y":565,"width":20,"height":30},{"x":650,"y":555,"width":140,"height":10},{"x":180,"y":580,"width":20,"height":40},{"x":450,"y":565,"width":20,"height":10},{"x":645,"y":565,"width":150,"height":10},{"x":95,"y":575,"width":10,"height":10},{"x":285,"y":580,"width":30,"height":20},{"x":335,"y":575,"width":10,"height":10},{"x":450,"y":575,"width":20,"height":10},{"x":660,"y":595,"width":120,"height":50},{"x":100,"y":585,"width":20,"height":10},{"x":195,"y":585,"width":10,"height":10},{"x":240,"y":595,"width":20,"height":30},{"x":335,"y":585,"width":10,"height":10},{"x":445,"y":585,"width":30,"height":10},{"x":100,"y":595,"width":20,"height":10},{"x":195,"y":595,"width":10,"height":10},{"x":340,"y":595,"width":40,"height":10},{"x":430,"y":600,"width":20,"height":20},{"x":100,"y":605,"width":20,"height":10},{"x":350,"y":605,"width":20,"height":10},{"x":340,"y":630,"width":20,"height":20},{"x":665,"y":630,"width":110,"height":20},{"x":280,"y":655,"width":20,"height":50},{"x":400,"y":645,"width":20,"height":30},{"x":430,"y":635,"width":20,"height":10},{"x":540,"y":650,"width":20,"height":40},{"x":430,"y":645,"width":40,"height":10},{"x":670,"y":650,"width":100,"height":20},{"x":310,"y":655,"width":40,"height":10},{"x":435,"y":655,"width":50,"height":10},{"x":375,"y":665,"width":170,"height":10},{"x":665,"y":675,"width":110,"height":30},{"x":350,"y":675,"width":100,"height":10},{"x":440,"y":675,"width":40,"height":10},{"x":310,"y":685,"width":20,"height":10},{"x":550,"y":685,"width":20,"height":10},{"x":545,"y":700,"width":30,"height":20},{"x":660,"y":700,"width":120,"height":20},{"x":205,"y":710,"width":10,"height":20},{"x":220,"y":715,"width":20,"height":10},{"x":270,"y":715,"width":20,"height":10},{"x":540,"y":715,"width":20,"height":10},{"x":655,"y":735,"width":130,"height":50},{"x":200,"y":725,"width":60,"height":10},{"x":260,"y":725,"width":20,"height":10},{"x":195,"y":735,"width":150,"height":10},{"x":205,"y":760,"width":190,"height":40},{"x":335,"y":745,"width":10,"height":10},{"x":320,"y":755,"width":40,"height":10},{"x":95,"y":765,"width":10,"height":10},{"x":320,"y":765,"width":40,"height":10},{"x":650,"y":765,"width":140,"height":10},{"x":95,"y":775,"width":10,"height":10},{"x":330,"y":775,"width":60,"height":10},{"x":470,"y":810,"width":20,"height":80},{"x":545,"y":830,"width":10,"height":120},{"x":655,"y":820,"width":130,"height":100},{"x":95,"y":785,"width":10,"height":10},{"x":125,"y":785,"width":30,"height":10},{"x":185,"y":790,"width":10,"height":20},{"x":310,"y":785,"width":100,"height":10},{"x":485,"y":785,"width":10,"height":10},{"x":95,"y":795,"width":10,"height":10},{"x":125,"y":800,"width":10,"height":20},{"x":320,"y":795,"width":80,"height":10},{"x":485,"y":795,"width":10,"height":10},{"x":95,"y":805,"width":10,"height":10},{"x":330,"y":805,"width":60,"height":10},{"x":495,"y":805,"width":30,"height":10},{"x":95,"y":815,"width":10,"height":10},{"x":340,"y":830,"width":40,"height":40},{"x":495,"y":815,"width":30,"height":10},{"x":365,"y":825,"width":10,"height":10},{"x":495,"y":825,"width":30,"height":10},{"x":40,"y":980,"width":80,"height":300},{"x":380,"y":835,"width":40,"height":10},{"x":495,"y":835,"width":30,"height":10},{"x":385,"y":845,"width":50,"height":10},{"x":495,"y":845,"width":30,"height":10},{"x":360,"y":855,"width":100,"height":10},{"x":480,"y":855,"width":20,"height":10},{"x":350,"y":865,"width":120,"height":10},{"x":475,"y":870,"width":10,"height":20},{"x":90,"y":875,"width":20,"height":10},{"x":345,"y":875,"width":130,"height":10},{"x":660,"y":895,"width":120,"height":50},{"x":90,"y":885,"width":20,"height":10},{"x":320,"y":885,"width":120,"height":10},{"x":90,"y":895,"width":20,"height":10},{"x":265,"y":900,"width":10,"height":20},{"x":330,"y":895,"width":100,"height":10},{"x":540,"y":895,"width":20,"height":10},{"x":575,"y":905,"width":10,"height":30},{"x":90,"y":905,"width":20,"height":10},{"x":325,"y":905,"width":110,"height":10},{"x":510,"y":905,"width":60,"height":10},{"x":90,"y":915,"width":20,"height":10},{"x":320,"y":915,"width":100,"height":10},{"x":480,"y":915,"width":20,"height":10},{"x":90,"y":925,"width":20,"height":10},{"x":305,"y":925,"width":110,"height":10},{"x":470,"y":925,"width":20,"height":10},{"x":530,"y":925,"width":40,"height":10},{"x":570,"y":925,"width":20,"height":10},{"x":655,"y":1005,"width":130,"height":170},{"x":90,"y":935,"width":20,"height":10},{"x":295,"y":940,"width":110,"height":20},{"x":460,"y":935,"width":20,"height":10},{"x":505,"y":935,"width":30,"height":10},{"x":565,"y":935,"width":10,"height":10},{"x":90,"y":945,"width":20,"height":10},{"x":450,"y":945,"width":20,"height":10},{"x":560,"y":945,"width":20,"height":10},{"x":90,"y":955,"width":20,"height":10},{"x":255,"y":960,"width":50,"height":20},{"x":325,"y":955,"width":50,"height":10},{"x":400,"y":955,"width":20,"height":10},{"x":445,"y":955,"width":10,"height":10},{"x":555,"y":955,"width":10,"height":10},{"x":90,"y":965,"width":20,"height":10},{"x":330,"y":965,"width":40,"height":10},{"x":390,"y":965,"width":20,"height":10},{"x":435,"y":965,"width":10,"height":10},{"x":550,"y":965,"width":20,"height":10},{"x":90,"y":975,"width":20,"height":10},{"x":250,"y":980,"width":60,"height":20},{"x":295,"y":975,"width":10,"height":10},{"x":340,"y":980,"width":20,"height":20},{"x":385,"y":985,"width":10,"height":30},{"x":540,"y":975,"width":20,"height":10},{"x":100,"y":985,"width":40,"height":10},{"x":305,"y":990,"width":10,"height":20},{"x":470,"y":985,"width":20,"height":10},{"x":525,"y":985,"width":30,"height":10},{"x":105,"y":995,"width":50,"height":10},{"x":250,"y":995,"width":80,"height":10},{"x":330,"y":995,"width":40,"height":10},{"x":445,"y":1000,"width":10,"height":20},{"x":465,"y":1040,"width":10,"height":100},{"x":515,"y":995,"width":10,"height":10},{"x":105,"y":1005,"width":50,"height":10},{"x":270,"y":1005,"width":160,"height":10},{"x":395,"y":1010,"width":10,"height":20},{"x":510,"y":1005,"width":20,"height":10},{"x":125,"y":1015,"width":90,"height":10},{"x":240,"y":1015,"width":80,"height":10},{"x":315,"y":1020,"width":50,"height":20},{"x":405,"y":1045,"width":10,"height":70},{"x":440,"y":1015,"width":20,"height":10},{"x":505,"y":1015,"width":10,"height":10},{"x":125,"y":1025,"width":90,"height":10},{"x":230,"y":1025,"width":60,"height":10},{"x":435,"y":1055,"width":10,"height":70},{"x":555,"y":1055,"width":10,"height":70},{"x":130,"y":1035,"width":100,"height":10},{"x":235,"y":1035,"width":50,"height":10},{"x":305,"y":1035,"width":50,"height":10},{"x":385,"y":1035,"width":10,"height":10},{"x":130,"y":1045,"width":100,"height":10},{"x":235,"y":1050,"width":30,"height":20},{"x":290,"y":1045,"width":60,"height":10},{"x":380,"y":1045,"width":20,"height":10},{"x":135,"y":1055,"width":110,"height":10},{"x":280,"y":1055,"width":60,"height":10},{"x":370,"y":1055,"width":20,"height":10},{"x":135,"y":1065,"width":110,"height":10},{"x":265,"y":1065,"width":70,"height":10},{"x":365,"y":1065,"width":10,"height":10},{"x":140,"y":1075,"width":120,"height":10},{"x":260,"y":1075,"width":60,"height":10},{"x":360,"y":1075,"width":20,"height":10},{"x":145,"y":1085,"width":130,"height":10},{"x":255,"y":1085,"width":50,"height":10},{"x":355,"y":1090,"width":10,"height":20},{"x":400,"y":1085,"width":20,"height":10},{"x":145,"y":1095,"width":130,"height":10},{"x":255,"y":1095,"width":30,"height":10},{"x":425,"y":1100,"width":10,"height":20},{"x":455,"y":1095,"width":10,"height":10},{"x":550,"y":1095,"width":20,"height":10},{"x":660,"y":1100,"width":120,"height":20},{"x":145,"y":1105,"width":130,"height":10},{"x":350,"y":1105,"width":20,"height":10},{"x":545,"y":1105,"width":10,"height":10},{"x":150,"y":1115,"width":140,"height":10},{"x":345,"y":1115,"width":10,"height":10},{"x":420,"y":1115,"width":20,"height":10},{"x":540,"y":1115,"width":20,"height":10},{"x":665,"y":1120,"width":110,"height":20},{"x":105,"y":1125,"width":50,"height":10},{"x":145,"y":1130,"width":10,"height":20},{"x":415,"y":1125,"width":10,"height":10},{"x":535,"y":1125,"width":10,"height":10},{"x":35,"y":1355,"width":70,"height":450},{"x":530,"y":1135,"width":20,"height":10},{"x":660,"y":1145,"width":120,"height":30},{"x":280,"y":1145,"width":20,"height":10},{"x":525,"y":1145,"width":10,"height":10},{"x":280,"y":1155,"width":40,"height":10},{"x":75,"y":1165,"width":10,"height":10},{"x":275,"y":1170,"width":30,"height":20},{"x":655,"y":1175,"width":130,"height":30},{"x":75,"y":1175,"width":10,"height":10},{"x":295,"y":1175,"width":10,"height":10},{"x":80,"y":1185,"width":20,"height":10},{"x":275,"y":1185,"width":50,"height":10},{"x":80,"y":1195,"width":20,"height":10},{"x":265,"y":1195,"width":50,"height":10},{"x":650,"y":1210,"width":140,"height":40},{"x":80,"y":1205,"width":20,"height":10},{"x":255,"y":1215,"width":70,"height":30},{"x":80,"y":1215,"width":20,"height":10},{"x":490,"y":1215,"width":20,"height":10},{"x":80,"y":1225,"width":20,"height":10},{"x":480,"y":1235,"width":40,"height":30},{"x":535,"y":1225,"width":10,"height":10},{"x":80,"y":1235,"width":20,"height":10},{"x":250,"y":1235,"width":60,"height":10},{"x":535,"y":1255,"width":30,"height":50},{"x":655,"y":1250,"width":130,"height":40},{"x":80,"y":1245,"width":20,"height":10},{"x":235,"y":1245,"width":70,"height":10},{"x":80,"y":1255,"width":20,"height":10},{"x":225,"y":1255,"width":70,"height":10},{"x":475,"y":1280,"width":30,"height":60},{"x":505,"y":1270,"width":10,"height":40},{"x":80,"y":1265,"width":20,"height":10},{"x":220,"y":1265,"width":60,"height":10},{"x":435,"y":1265,"width":30,"height":10},{"x":555,"y":1265,"width":10,"height":10},{"x":80,"y":1275,"width":20,"height":10},{"x":210,"y":1275,"width":60,"height":10},{"x":300,"y":1275,"width":20,"height":10},{"x":415,"y":1285,"width":70,"height":30},{"x":555,"y":1275,"width":10,"height":10},{"x":645,"y":1275,"width":150,"height":10},{"x":80,"y":1285,"width":20,"height":10},{"x":205,"y":1285,"width":70,"height":10},{"x":295,"y":1285,"width":30,"height":10},{"x":545,"y":1305,"width":30,"height":50},{"x":655,"y":1295,"width":130,"height":30},{"x":80,"y":1295,"width":20,"height":10},{"x":175,"y":1295,"width":10,"height":10},{"x":210,"y":1295,"width":40,"height":10},{"x":290,"y":1300,"width":40,"height":20},{"x":500,"y":1295,"width":20,"height":10},{"x":80,"y":1305,"width":20,"height":10},{"x":190,"y":1305,"width":80,"height":10},{"x":435,"y":1305,"width":30,"height":10},{"x":500,"y":1305,"width":20,"height":10},{"x":80,"y":1315,"width":20,"height":10},{"x":185,"y":1315,"width":70,"height":10},{"x":285,"y":1320,"width":50,"height":20},{"x":490,"y":1315,"width":40,"height":10},{"x":660,"y":1320,"width":120,"height":20},{"x":80,"y":1325,"width":20,"height":10},{"x":175,"y":1325,"width":70,"height":10},{"x":485,"y":1345,"width":30,"height":50},{"x":80,"y":1335,"width":20,"height":10},{"x":170,"y":1335,"width":60,"height":10},{"x":280,"y":1345,"width":80,"height":30},{"x":655,"y":1335,"width":130,"height":10},{"x":80,"y":1345,"width":20,"height":10},{"x":165,"y":1345,"width":50,"height":10},{"x":395,"y":1360,"width":30,"height":40},{"x":525,"y":1350,"width":10,"height":20},{"x":650,"y":1355,"width":140,"height":30},{"x":75,"y":1355,"width":10,"height":10},{"x":160,"y":1355,"width":40,"height":10},{"x":540,"y":1355,"width":20,"height":10},{"x":75,"y":1365,"width":10,"height":10},{"x":165,"y":1365,"width":30,"height":10},{"x":260,"y":1365,"width":60,"height":10},{"x":415,"y":1365,"width":10,"height":10},{"x":535,"y":1365,"width":70,"height":10},{"x":75,"y":1375,"width":10,"height":10},{"x":255,"y":1380,"width":70,"height":20},{"x":415,"y":1375,"width":10,"height":10},{"x":585,"y":1375,"width":270,"height":10},{"x":75,"y":1385,"width":10,"height":10},{"x":405,"y":1395,"width":30,"height":30},{"x":580,"y":1385,"width":280,"height":10},{"x":75,"y":1395,"width":10,"height":10},{"x":245,"y":1395,"width":90,"height":10},{"x":570,"y":1395,"width":300,"height":10},{"x":75,"y":1405,"width":10,"height":10},{"x":250,"y":1425,"width":80,"height":50},{"x":570,"y":1405,"width":300,"height":10},{"x":75,"y":1415,"width":10,"height":10},{"x":295,"y":1415,"width":10,"height":10},{"x":335,"y":1420,"width":10,"height":20},{"x":560,"y":1470,"width":320,"height":120},{"x":75,"y":1425,"width":10,"height":10},{"x":305,"y":1425,"width":30,"height":10},{"x":365,"y":1425,"width":10,"height":10},{"x":75,"y":1435,"width":10,"height":10},{"x":340,"y":1435,"width":100,"height":10},{"x":75,"y":1445,"width":10,"height":10},{"x":340,"y":1445,"width":100,"height":10},{"x":75,"y":1455,"width":10,"height":10},{"x":305,"y":1465,"width":170,"height":30},{"x":110,"y":1465,"width":80,"height":10},{"x":110,"y":1475,"width":80,"height":10},{"x":110,"y":1485,"width":80,"height":10},{"x":240,"y":1485,"width":40,"height":10},{"x":330,"y":1485,"width":120,"height":10},{"x":115,"y":1495,"width":90,"height":10},{"x":245,"y":1495,"width":30,"height":10},{"x":335,"y":1495,"width":110,"height":10},{"x":115,"y":1505,"width":90,"height":10},{"x":250,"y":1505,"width":20,"height":10},{"x":345,"y":1505,"width":90,"height":10},{"x":115,"y":1515,"width":90,"height":10},{"x":350,"y":1515,"width":40,"height":10},{"x":115,"y":1525,"width":90,"height":10},{"x":360,"y":1525,"width":40,"height":10},{"x":80,"y":1535,"width":20,"height":10},{"x":135,"y":1535,"width":70,"height":10},{"x":350,"y":1535,"width":20,"height":10},{"x":565,"y":1545,"width":310,"height":30},{"x":80,"y":1545,"width":20,"height":10},{"x":145,"y":1545,"width":50,"height":10},{"x":345,"y":1545,"width":10,"height":10},{"x":75,"y":1555,"width":10,"height":10},{"x":160,"y":1555,"width":40,"height":10},{"x":75,"y":1565,"width":10,"height":10},{"x":495,"y":1565,"width":130,"height":10},{"x":650,"y":1575,"width":140,"height":30},{"x":75,"y":1575,"width":10,"height":10},{"x":495,"y":1575,"width":110,"height":10},{"x":25,"y":1870,"width":50,"height":580},{"x":510,"y":1590,"width":20,"height":20},{"x":55,"y":1595,"width":10,"height":10},{"x":660,"y":1620,"width":120,"height":60},{"x":55,"y":1605,"width":10,"height":10},{"x":505,"y":1605,"width":10,"height":10},{"x":55,"y":1615,"width":10,"height":10},{"x":60,"y":1625,"width":20,"height":10},{"x":65,"y":1635,"width":30,"height":10},{"x":65,"y":1645,"width":30,"height":10},{"x":275,"y":1645,"width":30,"height":10},{"x":65,"y":1655,"width":30,"height":10},{"x":270,"y":1655,"width":40,"height":10},{"x":655,"y":1710,"width":130,"height":120},{"x":65,"y":1665,"width":30,"height":10},{"x":260,"y":1680,"width":60,"height":40},{"x":65,"y":1675,"width":30,"height":10},{"x":300,"y":1675,"width":20,"height":10},{"x":65,"y":1685,"width":30,"height":10},{"x":310,"y":1690,"width":20,"height":20},{"x":65,"y":1695,"width":30,"height":10},{"x":70,"y":1705,"width":40,"height":10},{"x":265,"y":1705,"width":90,"height":10},{"x":405,"y":1705,"width":10,"height":10},{"x":70,"y":1715,"width":40,"height":10},{"x":245,"y":1725,"width":90,"height":30},{"x":410,"y":1715,"width":40,"height":10},{"x":445,"y":1715,"width":10,"height":10},{"x":70,"y":1725,"width":40,"height":10},{"x":405,"y":1725,"width":90,"height":10},{"x":70,"y":1735,"width":40,"height":10},{"x":395,"y":1735,"width":110,"height":10},{"x":70,"y":1745,"width":40,"height":10},{"x":235,"y":1745,"width":110,"height":10},{"x":390,"y":1745,"width":120,"height":10},{"x":70,"y":1755,"width":40,"height":10},{"x":225,"y":1760,"width":110,"height":20},{"x":395,"y":1760,"width":150,"height":20},{"x":75,"y":1765,"width":50,"height":10},{"x":75,"y":1775,"width":50,"height":10},{"x":205,"y":1775,"width":110,"height":10},{"x":385,"y":1775,"width":130,"height":10},{"x":660,"y":1785,"width":120,"height":30},{"x":75,"y":1785,"width":50,"height":10},{"x":200,"y":1785,"width":120,"height":10},{"x":370,"y":1790,"width":100,"height":20},{"x":75,"y":1795,"width":50,"height":10},{"x":190,"y":1800,"width":100,"height":20},{"x":75,"y":1805,"width":50,"height":10},{"x":355,"y":1805,"width":70,"height":10},{"x":405,"y":1815,"width":10,"height":30},{"x":665,"y":1840,"width":110,"height":80},{"x":75,"y":1815,"width":50,"height":10},{"x":180,"y":1820,"width":80,"height":20},{"x":340,"y":1815,"width":100,"height":10},{"x":530,"y":1815,"width":20,"height":10},{"x":75,"y":1825,"width":50,"height":10},{"x":330,"y":1825,"width":120,"height":10},{"x":535,"y":1835,"width":10,"height":30},{"x":75,"y":1835,"width":50,"height":10},{"x":170,"y":1840,"width":60,"height":20},{"x":315,"y":1835,"width":130,"height":10},{"x":395,"y":1835,"width":10,"height":10},{"x":475,"y":1835,"width":10,"height":10},{"x":75,"y":1845,"width":50,"height":10},{"x":300,"y":1845,"width":160,"height":10},{"x":500,"y":1845,"width":40,"height":10},{"x":70,"y":1855,"width":40,"height":10},{"x":295,"y":1860,"width":170,"height":20},{"x":485,"y":1885,"width":10,"height":70},{"x":525,"y":1855,"width":30,"height":10},{"x":65,"y":1865,"width":30,"height":10},{"x":525,"y":1865,"width":70,"height":10},{"x":65,"y":1875,"width":30,"height":10},{"x":270,"y":1880,"width":140,"height":20},{"x":530,"y":1875,"width":80,"height":10},{"x":65,"y":1885,"width":30,"height":10},{"x":530,"y":1885,"width":80,"height":10},{"x":660,"y":1900,"width":120,"height":40},{"x":65,"y":1895,"width":30,"height":10},{"x":260,"y":1895,"width":120,"height":10},{"x":530,"y":1895,"width":80,"height":10},{"x":65,"y":1905,"width":30,"height":10},{"x":255,"y":1910,"width":110,"height":20},{"x":530,"y":1905,"width":80,"height":10},{"x":65,"y":1915,"width":30,"height":10},{"x":530,"y":1915,"width":80,"height":10},{"x":65,"y":1925,"width":30,"height":10},{"x":250,"y":1925,"width":100,"height":10},{"x":315,"y":1935,"width":10,"height":30},{"x":430,"y":1925,"width":60,"height":10},{"x":525,"y":1940,"width":70,"height":40},{"x":655,"y":1980,"width":130,"height":120},{"x":65,"y":1935,"width":30,"height":10},{"x":245,"y":1940,"width":110,"height":20},{"x":435,"y":1935,"width":50,"height":10},{"x":65,"y":1945,"width":30,"height":10},{"x":425,"y":1950,"width":30,"height":20},{"x":455,"y":1950,"width":10,"height":20},{"x":65,"y":1955,"width":30,"height":10},{"x":245,"y":1955,"width":130,"height":10},{"x":65,"y":1965,"width":30,"height":10},{"x":235,"y":1970,"width":110,"height":20},{"x":305,"y":1970,"width":10,"height":20},{"x":390,"y":1965,"width":20,"height":10},{"x":435,"y":1965,"width":30,"height":10},{"x":65,"y":1975,"width":30,"height":10},{"x":385,"y":1980,"width":10,"height":20},{"x":435,"y":1975,"width":50,"height":10},{"x":65,"y":1985,"width":30,"height":10},{"x":225,"y":2010,"width":90,"height":60},{"x":295,"y":1985,"width":10,"height":10},{"x":65,"y":1995,"width":30,"height":10},{"x":290,"y":1995,"width":20,"height":10},{"x":70,"y":2005,"width":40,"height":10},{"x":285,"y":2010,"width":10,"height":20},{"x":70,"y":2015,"width":40,"height":10},{"x":75,"y":2025,"width":50,"height":10},{"x":275,"y":2025,"width":10,"height":10},{"x":75,"y":2035,"width":50,"height":10},{"x":275,"y":2035,"width":10,"height":10},{"x":75,"y":2045,"width":50,"height":10},{"x":215,"y":2065,"width":70,"height":50},{"x":660,"y":2045,"width":120,"height":10},{"x":80,"y":2055,"width":60,"height":10},{"x":655,"y":2065,"width":130,"height":30},{"x":85,"y":2065,"width":70,"height":10},{"x":400,"y":2065,"width":140,"height":10},{"x":90,"y":2075,"width":80,"height":10},{"x":395,"y":2075,"width":170,"height":10},{"x":95,"y":2085,"width":90,"height":10},{"x":395,"y":2085,"width":210,"height":10},{"x":615,"y":2085,"width":210,"height":10},{"x":160,"y":2095,"width":220,"height":10},{"x":500,"y":2095,"width":440,"height":10},{"x":385,"y":2105,"width":670,"height":10},{"x":385,"y":2115,"width":670,"height":10},{"x":385,"y":2125,"width":670,"height":10},{"x":385,"y":2135,"width":670,"height":10},{"x":385,"y":2145,"width":670,"height":10},{"x":385,"y":2155,"width":670,"height":10}] diff --git a/assets/img/map/cave.png b/assets/img/map/cave.png new file mode 100644 index 0000000..0cbc8dd Binary files /dev/null and b/assets/img/map/cave.png differ diff --git a/assets/img/map/tileset.png b/assets/img/map/tileset.png new file mode 100644 index 0000000..e48eea1 Binary files /dev/null and b/assets/img/map/tileset.png differ diff --git a/assets/worlds/mainworld.json b/assets/worlds/mainworld.json index 45a78a5..ca552aa 100644 --- a/assets/worlds/mainworld.json +++ b/assets/worlds/mainworld.json @@ -3,6 +3,10 @@ "x": 10000.0, "y": 10000.0 }, + "player_spawn": { + "x": 220.0, + "y": 50.0 + }, "fish": [ { "x": 500.0, diff --git a/bundle/create-releases.sh b/bundle/create-releases.sh index 3837f1a..1005aa0 100755 --- a/bundle/create-releases.sh +++ b/bundle/create-releases.sh @@ -9,10 +9,10 @@ set -e # Make a uni-bundle echo "Creating a fat bundle for all platforms" rm -rf ./bundle/release -rm -rf ./bundle/ludum-dare-48.zip +rm -rf ./bundle/one-breath.zip mkdir -p ./bundle/release cp -r ./assets ./bundle/release -cp ./bundle/linux/release/ludum-dare-48 ./bundle/release/ludum-dare-48 -cp ./bundle/windows/release/ludum-dare-48.exe ./bundle/release/ludum-dare-48.exe +cp ./bundle/linux/release/one-breath ./bundle/release/one-breath +cp ./bundle/windows/release/one-breath.exe ./bundle/release/one-breath.exe cd ./bundle/release -zip -r ../ludum-dare-48.zip ./ \ No newline at end of file +zip -r ../one-breath.zip ./ \ No newline at end of file diff --git a/bundle/linux/create-release.sh b/bundle/linux/create-release.sh index 2e130e0..6e4b674 100755 --- a/bundle/linux/create-release.sh +++ b/bundle/linux/create-release.sh @@ -12,7 +12,7 @@ rm -rf ./bundle/linux/release-x86_64-unknown-linux-gnu.zip mkdir -p ./bundle/linux/release echo "Copying binary" -cp ./target/x86_64-unknown-linux-gnu/release/ludum-dare-48 ./bundle/linux/release +cp ./target/x86_64-unknown-linux-gnu/release/one-breath ./bundle/linux/release echo "Copying assets" cp -r ./assets ./bundle/linux/release diff --git a/bundle/windows/create-release.sh b/bundle/windows/create-release.sh index 46a2412..bf5c147 100755 --- a/bundle/windows/create-release.sh +++ b/bundle/windows/create-release.sh @@ -11,7 +11,7 @@ rm -rf ./bundle/windows/release-x86_64-pc-windows-gnu.zip mkdir -p ./bundle/windows/release echo "Copying binary" -cp ./target/x86_64-pc-windows-gnu/release/ludum-dare-48.exe ./bundle/windows/release +cp ./target/x86_64-pc-windows-gnu/release/one-breath.exe ./bundle/windows/release echo "Copying assets" cp -r ./assets ./bundle/windows/release diff --git a/src/entities/fish.rs b/src/entities/fish.rs index 869fb61..452d9ed 100644 --- a/src/entities/fish.rs +++ b/src/entities/fish.rs @@ -1,10 +1,10 @@ use rand::{Rng, prelude::ThreadRng}; use raylib::prelude::*; -use crate::{gamecore::GameCore, lib::utils::triangles::rotate_vector, player::Player}; +use crate::{gamecore::GameCore, lib::utils::triangles::rotate_vector, player::Player, world::World}; -const FISH_FOLLOW_PLAYER_DISTANCE: f32 = 80.0; -const FISH_FOLLOW_PLAYER_SPEED: f32 = 2.0; +const FISH_FOLLOW_PLAYER_DISTANCE: f32 = 30.0; +const FISH_FOLLOW_PLAYER_SPEED: f32 = 1.8; const FISH_FOLLOW_PLAYER_SPEED_FAST: f32 = FISH_FOLLOW_PLAYER_SPEED * 3.0; const FISH_ATTACH_RADIUS: f32 = 20.0; @@ -12,7 +12,7 @@ const FISH_ATTACH_RADIUS: f32 = 20.0; pub struct FishEntity { position: Vector2, direction: Vector2, - following_player: bool, + pub following_player: bool, size: Vector2, rng: ThreadRng } @@ -36,7 +36,7 @@ impl FishEntity { return output; } - pub fn handle_follow_player(&mut self, player: &Player, dt: f64) { + pub fn handle_follow_player(&mut self, player: &Player, dt: f64, other_fish: &Vec) { // Distance and direction to player let dist_to_player = player.position - self.position; let dist_to_player_lin = self.position.distance_to(player.position); @@ -66,7 +66,7 @@ impl FishEntity { self.position += movement; } - pub fn handle_free_movement(&mut self, player: &Player, dt: f64) { + pub fn handle_free_movement(&mut self, player: &mut Player, dt: f64) { // Distance and direction to player let dist_to_player = player.position - self.position; let dist_to_player_lin = self.position.distance_to(player.position); @@ -74,8 +74,11 @@ impl FishEntity { direction_to_player.normalize(); // Handle player picking up fish - if player.position.distance_to(self.position).abs() <= player.size.y * 1.2 { + if player.position.distance_to(self.position).abs() <= player.size.y * 2.2 { self.following_player = true; + + // Add currency to the player + player.coins += 1; } // Look at the player; @@ -83,9 +86,9 @@ impl FishEntity { self.direction = direction_to_player; } - pub fn update_position(&mut self, player: &Player, dt: f64) { + pub fn update_position(&mut self, player: &mut Player, dt: f64, other_fish: &Vec) { if self.following_player { - self.handle_follow_player(player, dt); + self.handle_follow_player(player, dt, other_fish); } else { self.handle_free_movement(player, dt); } diff --git a/src/gamecore.rs b/src/gamecore.rs index 2cd14c7..d8216b7 100644 --- a/src/gamecore.rs +++ b/src/gamecore.rs @@ -107,6 +107,7 @@ impl GameCore { world: World, progress: GameProgress, ) -> Self { + let player = Player::new(&world.player_spawn); Self { state: GameState::Loading, last_state: GameState::Loading, @@ -117,13 +118,13 @@ impl GameCore { .expect("Failed to load game assets. Can not launch!"), master_camera: Camera2D { offset: Vector2::zero(), - target: Vector2::zero(), + target: world.player_spawn, rotation: 0.0, - zoom: 1.0, + zoom: 2.0, }, show_simple_debug_info: false, world: world, - player: Player::new(), + player, progress: progress, } } diff --git a/src/lib/utils/profiler.rs b/src/lib/utils/profiler.rs index 6634e5b..c813885 100644 --- a/src/lib/utils/profiler.rs +++ b/src/lib/utils/profiler.rs @@ -134,7 +134,7 @@ impl GameProfiler { w_type: None, }, DataSet { - title: Some("Breath".to_string()), + title: Some("Boost".to_string()), value: json!(self.data.player_boost_percent), graph: Some(false), unit: Some("%".to_string()), diff --git a/src/lib/wrappers/animation.rs b/src/lib/wrappers/animation.rs index 3632dee..053cf2b 100644 --- a/src/lib/wrappers/animation.rs +++ b/src/lib/wrappers/animation.rs @@ -1,9 +1,4 @@ -use raylib::{ - core::color::Color, - math::{Rectangle, Vector2}, - prelude::{RaylibDraw, RaylibDrawHandle}, - texture::Texture2D, -}; +use raylib::{core::color::Color, math::{Rectangle, Vector2}, prelude::{RaylibDraw, RaylibDrawHandle, RaylibMode2D}, texture::Texture2D}; /// A wrapper around an animation spritesheet pub struct FrameAnimationWrapper { @@ -29,7 +24,9 @@ impl FrameAnimationWrapper { /// Start the animation pub fn start(&mut self, handle: &RaylibDrawHandle) { - self.start_time_seconds = handle.get_time(); + if self.start_time_seconds == 0.0 { + self.start_time_seconds = handle.get_time(); + } } /// Stop (and reset) the animation @@ -48,16 +45,17 @@ impl FrameAnimationWrapper { } /// Draw the next frame to the screen at `position` - pub fn draw(&mut self, handle: &mut RaylibDrawHandle, position: Vector2) { + pub fn draw(&mut self, handle: &mut RaylibMode2D, position: Vector2, rotation: f32) { let frame_id = self.get_current_frame_id(handle); - self.draw_frame(handle, position, frame_id); + self.draw_frame(handle, position, rotation, frame_id); } /// Draw a specified frame to the screen at `position` pub fn draw_frame( &mut self, - handle: &mut RaylibDrawHandle, + handle: &mut RaylibMode2D, position: Vector2, + rotation: f32, frame_number: u32, ) { // Determine the col number @@ -75,8 +73,20 @@ impl FrameAnimationWrapper { width: self.size.x, height: self.size.y, }; + let frame_dest = Rectangle { + x: position.x, + y: position.y, + width: self.size.x, + height: self.size.y, + }; + + // Rotation origin + let origin = Vector2 { + x: self.size.x / 2.0, + y: self.size.y / 2.0 + }; // Render - handle.draw_texture_rec(&mut self.sprite_sheet, frame_box, position, Color::WHITE); + handle.draw_texture_pro(&mut self.sprite_sheet, frame_box, frame_dest, origin, rotation, Color::WHITE); } } diff --git a/src/lib/wrappers/complexanimation.rs b/src/lib/wrappers/complexanimation.rs new file mode 100644 index 0000000..ad87572 --- /dev/null +++ b/src/lib/wrappers/complexanimation.rs @@ -0,0 +1,32 @@ +use std::usize; + +use raylib::prelude::*; + +pub struct FrameRange { + pub min: usize, + pub max: usize, +} + +pub struct ComplexAnimationTool { + sprite_sheet: Texture2D, + frames_per_second: f32, + frame_size: Vector2, + sprite_sheet_size_frames: Vector2 +} + +impl ComplexAnimationTool { + pub fn render_loop(&self, context_2d: &mut RaylibMode2D, bounds: Rectangle, rotation: f32, range: &FrameRange) { + + } + + pub fn render_frame(&self, context_2d: &mut RaylibMode2D, bounds: Rectangle, rotation: f32, id: usize) { + + // Convert the ID to an xy + let col_id = id % self.sprite_sheet_size_frames.x as usize; + let row_id = id / self.sprite_sheet_size_frames.y as usize; + + + + + } +} diff --git a/src/lib/wrappers/mod.rs b/src/lib/wrappers/mod.rs index 9af9ea2..1a8f43a 100644 --- a/src/lib/wrappers/mod.rs +++ b/src/lib/wrappers/mod.rs @@ -1,2 +1,3 @@ pub mod audio; -pub mod animation; \ No newline at end of file +pub mod animation; +pub mod complexanimation; \ No newline at end of file diff --git a/src/logic/ingame/mod.rs b/src/logic/ingame/mod.rs index 937b9c0..0ab477d 100644 --- a/src/logic/ingame/mod.rs +++ b/src/logic/ingame/mod.rs @@ -7,6 +7,9 @@ use raylib::prelude::*; use crate::{gamecore::{self, GameCore, GameState}, lib::wrappers::audio::player::AudioPlayer}; use self::shop::Shop; +use crate::{ + pallette::{WATER}, +}; use super::screen::Screen; @@ -34,7 +37,48 @@ impl InGameScreen { context_2d: &mut RaylibMode2D, game_core: &mut GameCore, ) { - context_2d.draw_circle(0, 0, 10.0, Color::BLACK); + // Build source bounds + let source_bounds = Rectangle { + x: 0.0, + y: 0.0, + width: game_core.resources.cave_mid_layer.width as f32, + height: game_core.resources.cave_mid_layer.height as f32, + }; + let world_bounds = Rectangle { + x: 0.0, + y: 0.0, + width: game_core.resources.cave_mid_layer.width as f32, + height: game_core.resources.cave_mid_layer.height as f32, + }; + + // Clear the background + context_2d.draw_rectangle_rec(world_bounds, WATER); + + // Render the world texture + context_2d.draw_texture_rec( + &game_core.resources.cave_mid_layer, + source_bounds, + Vector2 { + x: world_bounds.x, + y: world_bounds.y, + }, + Color::WHITE, + ); + } + + fn render_colliders( + &mut self, + context_2d: &mut RaylibMode2D, + game_core: &mut GameCore, + ) { + // Render every collider + for collider in game_core.world.colliders.iter() { + context_2d.draw_rectangle_lines_ex( + collider, + 1, + Color::RED, + ); + } } } @@ -63,27 +107,24 @@ impl Screen for InGameScreen { } - // Only render shop in shop period, otherwise allow player movement - if draw_handle.get_time() - game_core.last_state_change_time >= 0.05 - && self.current_state == InGameState::BUYING{ - - shop::render_shop(draw_handle, game_core, self); - - }else{ - // Update player movement - playerlogic::update_player_movement(draw_handle, game_core, window_center); - } + // Clear frame - draw_handle.clear_background(Color::BLUE); + draw_handle.clear_background(Color::BLACK); // Handle the pause menu being opened if draw_handle.is_key_pressed(KeyboardKey::KEY_ESCAPE) { return Some(GameState::PauseMenu); } - - + // Window dimensions + let win_height = draw_handle.get_screen_height(); + let win_width = draw_handle.get_screen_width(); + let window_center = Vector2 { + x: (win_width as f32 / 2.0), + y: (win_height as f32 / 2.0), + }; + let camera_window_center = window_center * (1.0 / game_core.master_camera.zoom); @@ -94,11 +135,14 @@ impl Screen for InGameScreen { // Render the world self.render_world(&mut context_2d, game_core); + if game_core.show_simple_debug_info{ + self.render_colliders(&mut context_2d, game_core); + } // Render entities - let mut fish = &mut game_core.world.fish; - for fish in fish.iter_mut() { - fish.update_position(&game_core.player, dt); + let fish_clone = game_core.world.fish.clone(); + for fish in game_core.world.fish.iter_mut() { + fish.update_position(&mut game_core.player, dt, &fish_clone); fish.render(&mut context_2d); } @@ -106,6 +150,18 @@ impl Screen for InGameScreen { playerlogic::render_player(&mut context_2d, game_core); } + + // Only render shop in shop period, otherwise allow player movement + if draw_handle.get_time() - game_core.last_state_change_time >= 0.05 + && self.current_state == InGameState::BUYING{ + + shop::render_shop(draw_handle, game_core, self); + + }else{ + // Update player movement + playerlogic::update_player_movement(draw_handle, game_core, window_center); + } + // Render the hud hud::render_hud(draw_handle, game_core, window_center); diff --git a/src/logic/ingame/playerlogic.rs b/src/logic/ingame/playerlogic.rs index 37c0a16..6446ec5 100644 --- a/src/logic/ingame/playerlogic.rs +++ b/src/logic/ingame/playerlogic.rs @@ -5,11 +5,11 @@ use crate::{ pallette::{TRANSLUCENT_WHITE_128, TRANSLUCENT_WHITE_64, TRANSLUCENT_WHITE_96}, }; -const NORMAL_PLAYER_SPEED: i32 = 4; +const NORMAL_PLAYER_SPEED: i32 = 3; const BOOST_PLAYER_SPEED: i32 = NORMAL_PLAYER_SPEED * 2; const CAMERA_FOLLOW_SPEED: f32 = 0.7; -const TURN_SPEED: f32 = 0.05; -const BOOST_DECREASE_PER_SECOND: f32 = 0.75; +const TURN_SPEED: f32 = 0.15; +const BOOST_DECREASE_PER_SECOND: f32 = 0.65; const BOOST_REGEN_PER_SECOND: f32 = 0.25; const BREATH_DECREASE_PER_SECOND: f32 = 0.01; @@ -27,45 +27,45 @@ pub fn update_player_movement( let raw_movement_direction = mouse_world_pose - game_core.player.position; let mut normalized_movement_direction = raw_movement_direction; normalized_movement_direction.normalize(); - - let tau: f32 = PI as f32 * 2.0; - // get angles as floats - let mut player_angle: f32 = Vector2::zero().angle_to(game_core.player.direction); - let mut desired_angle: f32 = Vector2::zero().angle_to(normalized_movement_direction); - // make angle positive - if desired_angle < 0.0 { - desired_angle += tau; - } + let tau: f32 = PI as f32 * 2.0; + // get angles as floats + let mut player_angle: f32 = Vector2::zero().angle_to(game_core.player.direction); + let mut desired_angle: f32 = Vector2::zero().angle_to(normalized_movement_direction); - // turn towards mouse at turn speed - if player_angle % tau > desired_angle { - if (player_angle % tau) - desired_angle > PI as f32 { - player_angle += TURN_SPEED; - } else { - player_angle -= TURN_SPEED; - } + // make angle positive + if desired_angle < 0.0 { + desired_angle += tau; + } + + // turn towards mouse at turn speed + if player_angle % tau > desired_angle { + if (player_angle % tau) - desired_angle > PI as f32 { + player_angle += TURN_SPEED; } else { - if desired_angle - (player_angle % tau) > PI as f32 { - player_angle -= TURN_SPEED; - } else { - player_angle += TURN_SPEED; - } + player_angle -= TURN_SPEED; } + } else { + if desired_angle - (player_angle % tau) > PI as f32 { + player_angle -= TURN_SPEED; + } else { + player_angle += TURN_SPEED; + } + } - // snap to mouse if close enough - if f32::abs(player_angle - desired_angle) < (TURN_SPEED * 1.1) { - player_angle = desired_angle; - } - if player_angle > tau { - player_angle -= tau; - } - if player_angle < 0.0 { - player_angle += tau; - } + // snap to mouse if close enough + if f32::abs(player_angle - desired_angle) < (TURN_SPEED * 1.1) { + player_angle = desired_angle; + } + if player_angle > tau { + player_angle -= tau; + } + if player_angle < 0.0 { + player_angle += tau; + } - // set angle - game_core.player.direction = Vector2::new(f32::cos(player_angle), f32::sin(player_angle)); + // set angle + game_core.player.direction = Vector2::new(f32::cos(player_angle), f32::sin(player_angle)); // In the case the player is in "null", just jump the camera to them if game_core.player.position == Vector2::zero() { @@ -84,10 +84,36 @@ pub fn update_player_movement( // Decrease the boost game_core.player.boost_percent -= BOOST_DECREASE_PER_SECOND * dt as f32; + game_core.player.is_boosting = true; + if game_core.player.boost_percent >= 0.9 { + game_core + .resources + .player_animation_boost_charge + .start(draw_handle); + game_core.resources.player_animation_regular.stop(); + game_core.player.is_boost_charging = true; + } else { + game_core.resources.player_animation_boost_charge.stop(); + game_core + .resources + .player_animation_boost + .start(draw_handle); + game_core.player.is_boost_charging = false; + } } else { // Set the speed multiplier speed_multiplier = NORMAL_PLAYER_SPEED as f32; + // Reset boost animation + game_core.player.is_boosting = false; + game_core.player.is_boost_charging = false; + game_core.resources.player_animation_boost_charge.stop(); + game_core.resources.player_animation_boost.stop(); + game_core + .resources + .player_animation_regular + .start(draw_handle); + // Handle boost regen if !user_request_boost { game_core.player.boost_percent = (game_core.player.boost_percent @@ -103,7 +129,22 @@ pub fn update_player_movement( // Only do this if the mouse is far enough away let player_real_movement = game_core.player.direction * speed_multiplier; if raw_movement_direction.distance_to(Vector2::zero()) > game_core.player.size.y / 2.0 { + game_core.player.is_moving = true; game_core.player.position += player_real_movement; + + // Check for any collisions + for collider in game_core.world.colliders.iter() { + if game_core.player.collides_with_rec(collider) { + game_core.player.is_moving = false; + break; + } + } + + if !game_core.player.is_moving { + game_core.player.position -= player_real_movement; + } + } else { + game_core.player.is_moving = false; } // Move the camera to follow the player @@ -113,9 +154,19 @@ pub fn update_player_movement( draw_handle.get_world_to_screen2D(game_core.player.position, game_core.master_camera); // Camera only moves if you get close to the edge of the screen - if player_screen_position.distance_to(window_center).abs() > (window_center.y - 40.0) { + if player_screen_position.distance_to(window_center).abs() > 100.0 { game_core.master_camera.target += player_real_movement; } + + // If the player is not on screen, snap the camera to them + if player_screen_position.distance_to(window_center).abs() > window_center.y { + game_core.master_camera.target = game_core.player.position - (window_center / 2.0); + } + + // // Clamp camera target y to 0 + // if game_core.master_camera.target.y < -100.0 { + // game_core.master_camera.target.y = -100.0; + // } } pub fn render_player(context_2d: &mut RaylibMode2D, game_core: &mut GameCore) { @@ -135,25 +186,43 @@ pub fn render_player(context_2d: &mut RaylibMode2D, game_core: TRANSLUCENT_WHITE_64, ); context_2d.draw_ring( - player.position, - boost_ring_max_radius - 2.0, - boost_ring_max_radius + 2.0, + Vector2 { + x: player.position.x as i32 as f32, + y: player.position.y as i32 as f32, + }, + boost_ring_max_radius, + boost_ring_max_radius + 1.0, 0, (360.0 * player.breath_percent) as i32, 0, TRANSLUCENT_WHITE_96, ); - // TODO: tmp rect - context_2d.draw_rectangle_pro( - Rectangle { - x: player.position.x, - y: player.position.y, - width: player.size.x, - height: player.size.y, - }, - player.size / 2.0, - player_rotation.to_degrees() + 90.0, - Color::BLACK, - ); + // Render the player based on what is happening + if player.is_boost_charging { + game_core.resources.player_animation_boost_charge.draw( + context_2d, + player.position, + player_rotation.to_degrees() - 90.0, + ); + } else if player.is_boosting { + game_core.resources.player_animation_boost.draw( + context_2d, + player.position, + player_rotation.to_degrees() - 90.0, + ); + } else if player.is_moving { + game_core.resources.player_animation_regular.draw( + context_2d, + player.position, + player_rotation.to_degrees() - 90.0, + ); + } else { + game_core.resources.player_animation_regular.draw_frame( + context_2d, + player.position, + player_rotation.to_degrees() - 90.0, + 0, + ); + } } diff --git a/src/logic/mainmenu.rs b/src/logic/mainmenu.rs index 893494e..e3fc664 100644 --- a/src/logic/mainmenu.rs +++ b/src/logic/mainmenu.rs @@ -28,11 +28,11 @@ impl Screen for MainMenuScreen { let win_width = draw_handle.get_screen_width(); // Clear frame - draw_handle.clear_background(Color::WHITE); + draw_handle.clear_background(Color::BLUE); // Render title draw_handle.draw_text( - "TMP TITLE", + "ONE BREATH", (win_height / 2) - 80, win_width / 4, 40, diff --git a/src/logic/pausemenu.rs b/src/logic/pausemenu.rs index 64daf35..30c91f4 100644 --- a/src/logic/pausemenu.rs +++ b/src/logic/pausemenu.rs @@ -7,7 +7,7 @@ use crate::{ use super::screen::Screen; -const SCREEN_PANEL_SIZE: Vector2 = Vector2 { x: 300.0, y: 300.0 }; +const SCREEN_PANEL_SIZE: Vector2 = Vector2 { x: 300.0, y: 380.0 }; pub struct PauseMenuScreen {} @@ -118,6 +118,15 @@ impl Screen for PauseMenuScreen { } } + // Render credits + draw_handle.draw_text( + "Credits:\n\t- @ewpratten\n\t- @rsninja722\n\t- @wm-c\n\t- @catarinaburghi", + (win_width / 2) - (SCREEN_PANEL_SIZE.x as i32 / 2) + 10, + (win_height / 2) - (SCREEN_PANEL_SIZE.y as i32 / 2) + 120, + 20, + Color::BLACK, + ); + // Close and quit buttons let bottom_left_button_dimensions = Rectangle { x: (win_width as f32 / 2.0) - (SCREEN_PANEL_SIZE.x / 2.0) + 5.0, diff --git a/src/main.rs b/src/main.rs index 0016bc3..75a8769 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,14 +13,14 @@ use lib::{utils::profiler::GameProfiler, wrappers::audio::player::AudioPlayer}; use log::info; use logic::{gameend::GameEndScreen, ingame::InGameScreen, loadingscreen::LoadingScreen, mainmenu::MainMenuScreen, pausemenu::PauseMenuScreen, screen::Screen}; use raylib::prelude::*; -use world::World; +use world::{World, load_world_colliders}; // Game Launch Configuration const DEFAULT_WINDOW_DIMENSIONS: Vector2 = Vector2 { x: 1080.0, y: 720.0, }; -const WINDOW_TITLE: &str = r"Ludum Dare 48"; +const WINDOW_TITLE: &str = r"One Breath"; const MAX_FPS: u32 = 60; fn main() { @@ -32,7 +32,7 @@ fn main() { .size( DEFAULT_WINDOW_DIMENSIONS.x as i32, DEFAULT_WINDOW_DIMENSIONS.y as i32, - ) + ).msaa_4x() .title(WINDOW_TITLE) .build(); raylib.set_target_fps(MAX_FPS); @@ -41,7 +41,8 @@ fn main() { raylib.set_exit_key(None); // Load the world - let world = World::load_from_json("./assets/worlds/mainworld.json".to_string()).expect("Failed to load main world JSON"); + let world_colliders = load_world_colliders("./assets/img/map/cave.json".to_string()).expect("Failed to load world colliders"); + let world = World::load_from_json("./assets/worlds/mainworld.json".to_string(), world_colliders).expect("Failed to load main world JSON"); // Load the game progress let game_progress = GameProgress::try_from_file("./assets/savestate.json".to_string()); diff --git a/src/pallette.rs b/src/pallette.rs index 9d70e98..5d675ca 100644 --- a/src/pallette.rs +++ b/src/pallette.rs @@ -19,4 +19,18 @@ pub const TRANSLUCENT_WHITE_64: Color = Color { g: 255, b: 255, a: 64, +}; + +pub const SKY: Color = Color { + r: 15, + g: 193, + b: 217, + a: 255 +}; + +pub const WATER: Color = Color { + r: 24, + g: 66, + b: 143, + a: 255 }; \ No newline at end of file diff --git a/src/player.rs b/src/player.rs index a455e9b..01c5343 100644 --- a/src/player.rs +++ b/src/player.rs @@ -1,6 +1,6 @@ -use raylib::math::Vector2; - +use raylib::math::{Rectangle, Vector2}; +use crate::lib::utils::triangles::rotate_vector; #[derive(Debug, Default)] pub struct Player { @@ -9,20 +9,51 @@ pub struct Player { pub size: Vector2, pub coins: u32, pub boost_percent: f32, - pub breath_percent: f32 + pub breath_percent: f32, + pub is_moving: bool, + pub is_boosting: bool, + pub is_boost_charging: bool, } impl Player { - pub fn new() -> Self { + pub fn new(spawn: &Vector2) -> Self { Self { boost_percent: 1.0, - size: Vector2 { - x: 11.0 * 4.0, - y: 21.0 * 4.0 - }, + size: Vector2 { x: 11.0, y: 21.0 }, breath_percent: 1.0, + position: spawn.clone(), ..Default::default() - } } -} \ No newline at end of file + + pub fn collides_with_rec(&self, rectangle: &Rectangle) -> bool { + // // Build a bounding box of the player by their corners + // let top_left_corner = self.position - (self.size / 2.0); + // let bottom_right_corner = self.position + (self.size / 2.0); + // let top_right_corner = Vector2 { + // x: bottom_right_corner.x, + // y: top_left_corner.y, + // }; + // let bottom_left_corner = Vector2 { + // x: top_left_corner.x, + // y: bottom_right_corner.y, + // }; + + // // Get the rotation + // let rotation = Vector2::zero().angle_to(self.direction); + + // // Rotate the bounds + // let top_left_corner = rotate_vector(top_left_corner, rotation); + // let bottom_right_corner = rotate_vector(bottom_right_corner, rotation); + // let top_right_corner = rotate_vector(top_right_corner, rotation); + // let bottom_left_corner = rotate_vector(bottom_left_corner, rotation); + + // // Check for collisions + // return rectangle.check_collision_point_rec(top_left_corner) + // || rectangle.check_collision_point_rec(bottom_right_corner) + // || rectangle.check_collision_point_rec(top_right_corner) + // || rectangle.check_collision_point_rec(bottom_left_corner); + + return rectangle.check_collision_circle_rec(self.position, (self.size.y * 0.5) / 2.0); + } +} diff --git a/src/resources.rs b/src/resources.rs index 9ca9a7d..b88c5a4 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -1,19 +1,68 @@ use failure::Error; -use raylib::{RaylibHandle, RaylibThread, texture::{Image, Texture2D}}; +use raylib::{ + math::Vector2, + texture::{Image, Texture2D}, + RaylibHandle, RaylibThread, +}; + +use crate::lib::wrappers::animation::FrameAnimationWrapper; /// This struct contains all textures and sounds that must be loaded into (V)RAM at the start of the game pub struct GlobalResources { - // Branding - pub game_logo: Texture2D + pub game_logo: Texture2D, + // Player + pub player_animation_regular: FrameAnimationWrapper, + pub player_animation_boost_charge: FrameAnimationWrapper, + pub player_animation_boost: FrameAnimationWrapper, + + // Cave + pub cave_mid_layer: Texture2D } impl GlobalResources { /// Load all resources. **THIS WILL HANG!** - pub fn load_all(raylib: &mut RaylibHandle, thread: &RaylibThread) -> Result { + pub fn load_all( + raylib: &mut RaylibHandle, + thread: &RaylibThread, + ) -> Result { Ok(GlobalResources { - game_logo: raylib.load_texture_from_image(&thread, &Image::load_image("./assets/img/logos/game-logo.png")?)? + game_logo: raylib.load_texture_from_image( + &thread, + &Image::load_image("./assets/img/logos/game-logo.png")?, + )?, + player_animation_regular: FrameAnimationWrapper::new( + raylib.load_texture_from_image( + &thread, + &Image::load_image("./assets/img/character/diveNormal.png")?, + )?, + Vector2 { x: 11.0, y: 21.0 }, + 8, + 100 / 8, + ), + player_animation_boost_charge: FrameAnimationWrapper::new( + raylib.load_texture_from_image( + &thread, + &Image::load_image("./assets/img/character/diveStrokeCharge.png")?, + )?, + Vector2 { x: 11.0, y: 21.0 }, + 21, + 100 / 4, + ), + player_animation_boost: FrameAnimationWrapper::new( + raylib.load_texture_from_image( + &thread, + &Image::load_image("./assets/img/character/diveStroke.png")?, + )?, + Vector2 { x: 17.0, y: 21.0 }, + 21, + 30, + ), + cave_mid_layer: raylib.load_texture_from_image( + &thread, + &Image::load_image("./assets/img/map/cave.png")?, + )?, }) } } diff --git a/src/world.rs b/src/world.rs index 0212480..1f344fe 100644 --- a/src/world.rs +++ b/src/world.rs @@ -1,6 +1,6 @@ use std::{fs::File, io::BufReader}; -use raylib::math::Vector2; +use raylib::math::{Rectangle, Vector2}; use serde::{Deserialize, Serialize}; use std::io::Read; use failure::Error; @@ -10,16 +10,20 @@ use crate::entities::fish::FishEntity; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct World { pub end_position: Vector2, + pub player_spawn: Vector2, #[serde(rename = "fish")] pub fish_positions: Vec, #[serde(skip)] - pub fish: Vec + pub fish: Vec, + + #[serde(skip)] + pub colliders: Vec } impl World { - pub fn load_from_json(file: String) -> Result { + pub fn load_from_json(file: String, colliders: Vec) -> Result { // Load the file let file = File::open(file)?; let reader = BufReader::new(file); @@ -30,6 +34,39 @@ impl World { // Init all fish result.fish = FishEntity::new_from_positions(&result.fish_positions); + // Init colliders + result.colliders = Vec::new(); + for collider in colliders.iter(){ + result.colliders.push(Rectangle { + x: collider.x - (collider.width / 2.0), + y: collider.y - (collider.height / 2.0), + width: collider.width, + height: collider.height, + }); + } + Ok(result) } + + pub fn spend_coins(&mut self, count: usize) { + for _ in 0..count { + self.fish.pop(); + } + } + + pub fn reset(&mut self) { + for fish in self.fish.iter_mut() { + fish.following_player = false; + } + } } + + +pub fn load_world_colliders(file: String) -> Result, Error> { + // Load the file + let file = File::open(file)?; + let reader = BufReader::new(file); + + // Deserialize + Ok(serde_json::from_reader(reader)?) +} \ No newline at end of file