From a174837a53985efe72654dbda4be4ad063a15fbd Mon Sep 17 00:00:00 2001 From: SlyVTT Date: Sat, 22 Apr 2023 12:50:03 +0200 Subject: [PATCH] working on player movements --- CMakeLists.txt | 34 ++---- assets-cg/levels/level1.json | 44 -------- assets-cg/levels/level1.tmx | 20 ++-- assets-cg/levels/level2.json | 44 -------- assets-cg/levels/level2.tmx | 32 +++--- assets-cg/levels/level3.json | 44 -------- assets-cg/levels/level3.tmx | 48 ++++---- assets-cg/levels/tileset.png | Bin 8483 -> 8701 bytes assets-cg/levels/tilesetnpp.json | 14 --- assets-cg/levels/tilesetnpp.tsx | 4 +- assets-cg/sprites/circle.png | Bin 0 -> 133 bytes assets-cg/sprites/selected.png | Bin 0 -> 98 bytes buildpush | 3 + src/background.cpp | 97 ---------------- src/level.cpp | 172 ++++++++++++++++++++++++++++ src/{background.h => level.h} | 13 ++- src/main.cpp | 52 +++++---- src/player.cpp | 187 +++++++++++++++++++++---------- src/player.h | 16 +-- 19 files changed, 407 insertions(+), 417 deletions(-) delete mode 100644 assets-cg/levels/level1.json delete mode 100644 assets-cg/levels/level2.json delete mode 100644 assets-cg/levels/level3.json delete mode 100644 assets-cg/levels/tilesetnpp.json create mode 100644 assets-cg/sprites/circle.png create mode 100644 assets-cg/sprites/selected.png create mode 100755 buildpush delete mode 100644 src/background.cpp create mode 100644 src/level.cpp rename src/{background.h => level.h} (71%) diff --git a/CMakeLists.txt b/CMakeLists.txt index be22e43..227736d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,39 +15,27 @@ find_package(LibProf 2.4 REQUIRED) fxconv_declare_converters(assets-cg/converters.py) add_custom_command( - OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level1.json" - COMMENT "Convert Tiled TMX map to usable JSON file" + COMMENT "Convert Tiled TMX map to usable JSON file" COMMAND tiled --export-tileset json tilesetnpp.tsx tilesetnpp.json COMMAND find | grep .*.tmx | sed 's/.tmx//g' | xargs -l bash -c 'tiled --export-map json $$0.tmx $$0.json' - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/ - DEPENDS assets-cg/levels/level1.tmx - - OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level2.json" - COMMENT "Convert Tiled TMX map to usable JSON file" - COMMAND tiled --export-tileset json tilesetnpp.tsx tilesetnpp.json - COMMAND find | grep .*.tmx | sed 's/.tmx//g' | xargs -l bash -c 'tiled --export-map json $$0.tmx $$0.json' - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/ - DEPENDS assets-cg/levels/level2.tmx + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/ + OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level1.json" + OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level2.json" OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level3.json" - COMMENT "Convert Tiled TMX map to usable JSON file" - COMMAND tiled --export-tileset json tilesetnpp.tsx tilesetnpp.json - COMMAND find | grep .*.tmx | sed 's/.tmx//g' | xargs -l bash -c 'tiled --export-map json $$0.tmx $$0.json' - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/ - DEPENDS assets-cg/levels/level3.tmx - - assets-cg/converters.py + DEPENDS assets-cg/converters.py assets-cg/levels/tileset.png - assets-cg/levels/tilesetnpp.tsx) - - + assets-cg/levels/tilesetnpp.tsx + assets-cg/levels/level1.tmx + assets-cg/levels/level2.tmx + assets-cg/levels/level2.tmx) set(SOURCES src/main.cpp src/extrakeyboard.cpp src/utilities.cpp src/player.cpp - src/background.cpp + src/level.cpp # ... ) # Shared assets, fx-9860G-only assets and fx-CG-50-only assets @@ -62,6 +50,8 @@ set(ASSETS_cg #assets-cg/sprites/running.png #assets-cg/sprites/static.png assets-cg/sprites/rectangle.png + assets-cg/sprites/circle.png + assets-cg/sprites/selected.png assets-cg/levels/tileset.png assets-cg/levels/level1.json diff --git a/assets-cg/levels/level1.json b/assets-cg/levels/level1.json deleted file mode 100644 index a278493..0000000 --- a/assets-cg/levels/level1.json +++ /dev/null @@ -1,44 +0,0 @@ -{ "compressionlevel":-1, - "height":14, - "infinite":false, - "layers":[ - { - "data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 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":14, - "id":2, - "name":"Foreground", - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":25, - "x":0, - "y":0 - }], - "nextlayerid":3, - "nextobjectid":1, - "orientation":"orthogonal", - "renderorder":"right-down", - "tiledversion":"1.8.0", - "tileheight":16, - "tilesets":[ - { - "firstgid":1, - "source":"tilesetnpp.tsx" - }], - "tilewidth":16, - "type":"map", - "version":"1.8", - "width":25 -} \ No newline at end of file diff --git a/assets-cg/levels/level1.tmx b/assets-cg/levels/level1.tmx index 2201472..04f638d 100644 --- a/assets-cg/levels/level1.tmx +++ b/assets-cg/levels/level1.tmx @@ -1,5 +1,5 @@ - + @@ -23,17 +23,17 @@ 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,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,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,44,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,44,0, +0,44,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,44,44,0, +0,0,0,0,0,0,0,0,0,0,0,0,32,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,42,42,42,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,42,42,42,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,11,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,42,42,42,42,0,0,0,0,0,0,0,0,0,0,0,42,42,42,42,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 diff --git a/assets-cg/levels/level2.json b/assets-cg/levels/level2.json deleted file mode 100644 index 9985cc7..0000000 --- a/assets-cg/levels/level2.json +++ /dev/null @@ -1,44 +0,0 @@ -{ "compressionlevel":-1, - "height":14, - "infinite":false, - "layers":[ - { - "data":[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0, 0, 0, 0, 4, 2, 2, 2, 3, 0, 0, 0, 0, 0, 0, 4, 2, 5, 6, 0, 7, 8, 2, 3, 0, 0, 0, 0, 0, 0, 4, 2, 2, 0, 0, 20, 2, 2, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 2, 19, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 23, 24, 2, 21, 22, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 2, 1, 0, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 2, 3, 1, 4, 2, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 19, 0, 20, 2, 1, 0, 1, 2, 19, 0, 20, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 4, 2, 2, 2, 2, 2, 5, 6, 1, 2, 1, 7, 8, 2, 2, 2, 2, 2, 3, 0, 0, 2, 2, 19, 0, 0, 33, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 0, 20, 2, 2, 2, 19, 0, 33, 0, 0, 1, 0, 0, 23, 24, 2, 21, 22, 1, 0, 0, 0, 0, 33, 0, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], - "height":14, - "id":1, - "name":"Background", - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":25, - "x":0, - "y":0 - }, - { - "data":[0, 0, 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, 0, 0, 0, 0, 0, 0], - "height":14, - "id":2, - "name":"Foreground", - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":25, - "x":0, - "y":0 - }], - "nextlayerid":4, - "nextobjectid":3, - "orientation":"orthogonal", - "renderorder":"right-down", - "tiledversion":"1.8.0", - "tileheight":16, - "tilesets":[ - { - "firstgid":1, - "source":"tilesetnpp.tsx" - }], - "tilewidth":16, - "type":"map", - "version":"1.8", - "width":25 -} \ No newline at end of file diff --git a/assets-cg/levels/level2.tmx b/assets-cg/levels/level2.tmx index 7dda437..4bffc26 100644 --- a/assets-cg/levels/level2.tmx +++ b/assets-cg/levels/level2.tmx @@ -6,33 +6,33 @@ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 2,2,3,0,0,0,0,4,2,2,2,2,2,2,2,2,2,3,0,0,0,0,4,2,2, 2,3,0,0,0,0,0,0,4,2,5,6,0,7,8,2,3,0,0,0,0,0,0,4,2, -2,0,0,20,2,2,19,0,0,0,0,0,0,0,0,0,0,0,20,2,2,19,0,0,2, +2,0,0,14,2,2,13,0,0,0,0,0,0,0,0,0,0,0,14,2,2,13,0,0,2, 2,0,0,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0,2, -2,0,0,2,2,2,2,0,0,0,23,24,2,21,22,0,0,0,2,2,2,2,0,0,2, +2,0,0,2,2,2,2,0,0,0,17,18,2,15,16,0,0,0,2,2,2,2,0,0,2, 2,1,0,2,2,2,2,0,0,0,2,2,2,2,2,0,0,0,2,2,2,2,0,0,2, 2,0,0,2,2,2,2,0,0,0,2,3,1,4,2,0,0,0,2,2,2,2,0,0,2, -2,0,0,2,2,2,2,19,0,20,2,1,0,1,2,19,0,20,2,2,2,2,0,0,2, +2,0,0,2,2,2,2,13,0,14,2,1,0,1,2,13,0,14,2,2,2,2,0,0,2, 2,0,0,2,2,2,2,2,2,2,2,1,2,1,2,2,2,2,2,2,2,2,0,0,2, 2,0,0,4,2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0,0,43,0,0,0,0,0,43,0,0,0,0,0,0,0,0,0, +0,0,42,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,42,0,0, +0,23,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,34,0, +0,0,42,0,0,0,0,0,0,34,0,0,0,0,0,23,0,0,0,0,0,0,42,0,0, +0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,0,0, +0,0,42,0,0,0,0,0,33,0,0,0,32,0,0,1,33,0,0,0,0,0,42,0,0, +0,23,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,34,0, +0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,41,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 diff --git a/assets-cg/levels/level3.json b/assets-cg/levels/level3.json deleted file mode 100644 index a67d7d3..0000000 --- a/assets-cg/levels/level3.json +++ /dev/null @@ -1,44 +0,0 @@ -{ "compressionlevel":-1, - "height":14, - "infinite":false, - "layers":[ - { - "data":[1, 1, 1, 1, 23, 24, 2, 2, 21, 22, 1, 1, 1, 1, 1, 23, 24, 2, 2, 21, 22, 1, 1, 1, 1, 1, 1, 1, 20, 5, 6, 0, 34, 7, 8, 21, 22, 1, 23, 24, 5, 6, 34, 0, 7, 8, 19, 1, 1, 1, 1, 1, 20, 3, 0, 0, 0, 34, 0, 0, 4, 2, 2, 2, 3, 0, 0, 34, 0, 0, 0, 4, 19, 1, 1, 1, 20, 3, 0, 0, 0, 0, 34, 0, 0, 0, 10, 2, 9, 0, 0, 0, 34, 0, 0, 0, 0, 4, 19, 1, 42, 9, 0, 0, 0, 0, 2, 2, 0, 0, 0, 26, 2, 25, 0, 0, 0, 2, 2, 1, 1, 1, 1, 10, 41, 58, 25, 0, 0, 23, 24, 2, 2, 41, 0, 0, 0, 2, 0, 0, 0, 42, 2, 2, 21, 22, 0, 0, 26, 57, 2, 0, 0, 20, 2, 2, 2, 2, 57, 0, 0, 0, 0, 0, 0, 0, 58, 2, 2, 2, 2, 19, 0, 0, 2, 2, 0, 0, 4, 2, 2, 2, 2, 2, 21, 22, 0, 0, 0, 23, 24, 2, 2, 2, 2, 2, 3, 0, 0, 2, 10, 41, 0, 0, 7, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 6, 0, 0, 42, 9, 26, 57, 0, 0, 0, 0, 4, 2, 5, 6, 0, 0, 0, 0, 0, 7, 8, 2, 3, 0, 0, 0, 0, 58, 25, 1, 4, 19, 0, 0, 0, 0, 33, 0, 0, 0, 20, 2, 19, 0, 0, 0, 33, 0, 0, 0, 0, 20, 3, 1, 1, 1, 4, 19, 0, 0, 0, 33, 0, 0, 20, 2, 2, 2, 19, 0, 0, 33, 0, 0, 0, 20, 3, 1, 1, 1, 1, 1, 4, 21, 22, 0, 33, 23, 24, 5, 6, 1, 7, 8, 21, 22, 33, 0, 23, 24, 3, 1, 1, 1, 1, 1, 1, 1, 7, 8, 2, 2, 5, 6, 1, 1, 1, 1, 1, 7, 8, 2, 2, 5, 6, 1, 1, 1, 1], - "height":14, - "id":1, - "name":"Background", - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":25, - "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, 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, 66, 0, 0, 0, 0, 66, 0, 0, 0, 66, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 66, 0, 0, 0, 66, 0, 0, 0, 0, 0, 66, 49, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0], - "height":14, - "id":2, - "name":"Foreground", - "opacity":1, - "type":"tilelayer", - "visible":true, - "width":25, - "x":0, - "y":0 - }], - "nextlayerid":3, - "nextobjectid":1, - "orientation":"orthogonal", - "renderorder":"right-down", - "tiledversion":"1.8.0", - "tileheight":16, - "tilesets":[ - { - "firstgid":1, - "source":"tilesetnpp.tsx" - }], - "tilewidth":16, - "type":"map", - "version":"1.8", - "width":25 -} \ No newline at end of file diff --git a/assets-cg/levels/level3.tmx b/assets-cg/levels/level3.tmx index 3984d01..befcba6 100644 --- a/assets-cg/levels/level3.tmx +++ b/assets-cg/levels/level3.tmx @@ -3,19 +3,19 @@ -1,1,1,1,23,24,2,2,21,22,1,1,1,1,1,23,24,2,2,21,22,1,1,1,1, -1,1,1,20,5,6,0,34,7,8,21,22,1,23,24,5,6,34,0,7,8,19,1,1,1, -1,1,20,3,0,0,0,34,0,0,4,2,2,2,3,0,0,34,0,0,0,4,19,1,1, -1,20,3,0,0,0,0,34,0,0,0,10,2,9,0,0,0,34,0,0,0,0,4,19,1, -42,9,0,0,0,0,2,2,0,0,0,26,2,25,0,0,0,2,2,1,1,1,1,10,41, -58,25,0,0,23,24,2,2,41,0,0,0,2,0,0,0,42,2,2,21,22,0,0,26,57, -2,0,0,20,2,2,2,2,57,0,0,0,0,0,0,0,58,2,2,2,2,19,0,0,2, -2,0,0,4,2,2,2,2,2,21,22,0,0,0,23,24,2,2,2,2,2,3,0,0,2, -10,41,0,0,7,8,2,2,2,2,2,2,2,2,2,2,2,2,2,5,6,0,0,42,9, -26,57,0,0,0,0,4,2,5,6,0,0,0,0,0,7,8,2,3,0,0,0,0,58,25, -1,4,19,0,0,0,0,33,0,0,0,20,2,19,0,0,0,33,0,0,0,0,20,3,1, -1,1,4,19,0,0,0,33,0,0,20,2,2,2,19,0,0,33,0,0,0,20,3,1,1, -1,1,1,4,21,22,0,33,23,24,5,6,1,7,8,21,22,33,0,23,24,3,1,1,1, +1,1,1,1,17,18,2,2,15,16,1,1,1,1,1,17,18,2,2,15,16,1,1,1,1, +1,1,1,14,5,6,22,1,7,8,15,16,1,17,18,5,6,22,0,7,8,13,1,1,1, +1,1,14,3,0,0,22,1,0,0,4,2,2,2,3,0,0,22,0,0,0,4,13,1,1, +1,14,3,0,0,0,22,1,0,0,0,10,2,9,0,0,0,22,0,0,0,0,4,13,1, +30,9,0,0,0,0,2,2,0,0,0,20,2,19,0,0,0,2,2,1,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1,0,0,0,0,66,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0 +0,0,0,0,0,42,0,0,0,0,42,26,0,25,42,0,0,0,0,42,0,0,0,0,0, +28,25,0,0,42,0,0,0,0,0,42,36,0,35,42,0,0,0,0,0,42,31,0,26,27, +38,35,0,42,0,0,0,0,27,0,42,0,0,0,42,0,28,0,0,0,0,42,0,36,37, +0,0,42,0,0,0,0,0,37,0,0,0,0,0,0,0,38,0,0,0,0,0,42,0,0, +0,0,42,0,0,0,0,0,0,0,0,0,41,0,0,0,0,0,0,0,0,0,42,0,0, +26,27,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,0,28,25, +36,37,0,0,42,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,42,0,0,38,35, +0,0,0,0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,42,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 diff --git a/assets-cg/levels/tileset.png b/assets-cg/levels/tileset.png index 0afb6641732bab40e720176964b2c91ea1ec1c3a..393c424f362f66baedb48229a1e73d6c80a6bff6 100644 GIT binary patch delta 4760 zcmV;J5@+qBLj6M}iBL{Q4GJ0x0000DNk~Le0001>0000`2nGNE0G?fbGynhz;gKaD ze`}T-yA6c@_bRdkk{|(cIV3@xlO1IF`KZy%wS6CPuJbdJt!{O<_&@97Ind|#f|LuPjE7~+$<+GM#ri1fdQZ?e~ccHP%_=wR*K))`0e*b*5u%>b(OX5@H zy-K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?j10HA15N!}!<2*b>+A}Oc zI`Wc9w9Jr7iK?k;f!*Tf7x{Yc%=mgwc4tRfH>_)b6nzjG5q!K?!;6njKfvMa#m2H; z!xmeZhLRrc_S^typ5#ZO6<`4#JY(haRBtdd3S54Cqif=36K*S*IH66yfU242e6`7h zKe*FkcGBOCS^Bf-&)uz@Pm}c&$vv!!Khu&fw6SZ~o?A|8KjHk?rgPIf=*qe*QJG(e zz-vCWVgDj5T6LCejAul-+e=c_iyw3 zAwuR$UC`gdNp3v@P+T}9m_O>~=IhUtuFy~frhz8aN5A8H#I{pEtni}7iHT!^Y_hrA zyOwBf930l(R6(F4EJtb_eLH!QbN7$ZCkCu8BTyP4#THO^T5@nOU3<^)aKAOWqnpd7 z_0okE7uOYnIvGDbeHubln0iVS{oA9rftrN?(d`e4qr!WaPy87tarMt@>D#W;8pzaB zW_y+~Tl&>x?NzG}ttEs^cC|tG)V(y!XwD&8J+irr)bnI6qTF{v>iN%o^2^KT!Ba&6 zz^@p39SGQ2$`&;=Ne%cOinKXMj1ZV^#X3dLaYd7Hk*_onTVX_c36-5QA|hJco-?Sp zAs;hz5m`?!B=zQ_FHUg13-c1}lQ|LNDcg9l{E>+D#b>)@w^v7VOFwc@Fz^W8+{EH- zKb_SQXIop+&Cz<$-Yc4(@3m7&88#unQ3DUD%3ps_QWWq6b$c`M>?EOSi-ILGUMOd4Z;;3ym?LSW=g4iIXEWsLAn2_t~fW#BOY3aDH z9lGZOhq%5~OhF5yZRl-pi^9o@onGQ-9<;27cn_D;c0<=08n%4c+a3KZ>-b?ZlgAy(z9E&tV0?dO0N4SP5PrJ%v+RjG*~=ximd+<0>6vW_gQkSa{XD-<2Ip zSc>#*Pk*(`&aQOvh1KrG`r-)0rZ5g>&(TdiPlHM6`o)lceIm5 - - + + diff --git a/assets-cg/sprites/circle.png b/assets-cg/sprites/circle.png new file mode 100644 index 0000000000000000000000000000000000000000..62db1e84627df3d934e65c7eb78fc4bb87bbd8dc GIT binary patch literal 133 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`KAtX)Ar`&KDF>L=8UOj;?;A6@ zaiU->k1NA;w;HyCl1H-K%v&bPoITNIFmbVAr`&Kf6gEHFuzgAp_B2y vq{Khtz!Ym{=EEx(7qj(9F);Q_NlRy_wBQisUm2|d)WqQF>gTe~DWM4fm&_Vt literal 0 HcmV?d00001 diff --git a/buildpush b/buildpush new file mode 100755 index 0000000..9be693f --- /dev/null +++ b/buildpush @@ -0,0 +1,3 @@ +rm -r build-cg +rm *.g3a +fxsdk build-cg-push -s VERBOSE=1 diff --git a/src/background.cpp b/src/background.cpp deleted file mode 100644 index c70e889..0000000 --- a/src/background.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "background.h" -#include "player.h" -#include -#include - -#include -#include - - - -extern struct Map map_level1; -extern struct Map map_level2; -extern struct Map map_level3; - -extern bool drawbackground; - -struct Map *map_level; - - -Background::Background( ) -{ - map_level = &map_level2; -} - -Background::~Background( ) -{ - -} - -void Background::ChangeMap( int level, Player *MyPlayer ) -{ - if(level==1) map_level = &map_level1; - else if(level==2) map_level = &map_level2; - else if(level==3) map_level = &map_level3; - else map_level = &map_level1; - - UpdateDataMap( MyPlayer ); -} - -void Background::UpdateDataMap( Player *MyPlayer ) -{ - for(int i=0; iw; i++) - { - for(int j=0; j<=map_level->h; j++) - { - uint16_t index = (j) * map_level->w + (i) % map_level->w; - uint16_t currentTile = map_level->layers[1][ index ]; - if (currentTile==11) - { - MyPlayer->x = libnum::num( i*16 - 4 + 8 ); - MyPlayer->y = libnum::num( j*16 + 8 ); - MyPlayer->vx = 0; - MyPlayer->vy = 0; - MyPlayer->Update( 0.0f, 0.0f, 0.0f ); - } - } - } -} - -void Background::Render( void ) -{ - for(int u=!drawbackground; unblayers;u++) - { - for(int i=0; iw; i++) - { - for(int j=0; j<=map_level->h; j++) - { - uint16_t index = (j) * map_level->w + (i) % map_level->w; - uint16_t currentTile = map_level->layers[u][ index ]; - if (currentTile!=0 && currentTile!=11) - { - uint16_t xtile = ((currentTile % map_level->tileset_size)-1) * 16; - uint16_t ytile = (currentTile / map_level->tileset_size) * 16; - azrp_subimage_p8( i*16-4, j*16, map_level->tileset, xtile, ytile, 16, 16, DIMAGE_NONE ); - } - } - } - } -} - -void Background::Update( float dt ) -{ - -} - -bool Background::CanGo( Player *MyPlayer ) -{ - int tileX = ((int) MyPlayer->x+4) >> 4 ; - int tileY = ((int) MyPlayer->y+8) >> 4; - - int tileIndex = tileY*map_level->w + tileX; - - int tileValue = map_level->layers[0][ tileIndex ]; - - if (tileValue==0 || tileValue==1) return true; - else return false; -} \ No newline at end of file diff --git a/src/level.cpp b/src/level.cpp new file mode 100644 index 0000000..e67593f --- /dev/null +++ b/src/level.cpp @@ -0,0 +1,172 @@ +#include "level.h" +#include "player.h" +#include +#include + +#include +#include + +#define TILESIZE 16 + +extern struct Map map_level1; +extern struct Map map_level2; +extern struct Map map_level3; + +extern bool drawbackground; + +struct Map *map_level; + + +int tileXmin, tileXmax; +int tileYmin, tileYmax; +int XinTile, YinTile; + +extern bopti_image_t img_selected; + + +Level::Level( ) +{ + map_level = &map_level1; +} + +Level::~Level( ) +{ + +} + +void Level::ChangeMap( int level, Player *MyPlayer ) +{ + if(level==1) map_level = &map_level1; + else if(level==2) map_level = &map_level2; + else if(level==3) map_level = &map_level3; + else map_level = &map_level1; + + this->UpdateDataMap( MyPlayer ); +} + +void Level::UpdateDataMap( Player *MyPlayer ) +{ + for(int i=0; iw; i++) + { + for(int j=0; jh; j++) + { + uint16_t index = j * map_level->w + i; + uint16_t currentTile = map_level->layers[1][ index ]; + if (currentTile==32) + { + MyPlayer->x = (float) (i*16+8); + MyPlayer->y = (float) (j*16); + MyPlayer->vx = 0.0f; + MyPlayer->vy = 0.0f; + MyPlayer->Update( 0.0f ); + } + } + } +} + +void Level::Render( void ) +{ + for(int u=!drawbackground; unblayers;u++) + { + for(int i=0; iw; i++) + { + for(int j=0; jh; j++) + { + uint16_t index = j * map_level->w + i; + uint16_t currentTile = map_level->layers[u][ index ]; + if (currentTile!=0 && currentTile!=32) + { + uint16_t xtile = ((currentTile % map_level->tileset_size)-1) * 16; + uint16_t ytile = (currentTile / map_level->tileset_size) * 16; + azrp_subimage_p8( i*16, j*16, map_level->tileset, xtile, ytile, 16, 16, DIMAGE_NONE ); + + // TODO : + // the last column of tile is not fully drawn cause 4 pixels are missing + // to upgrade the + } + } + } + } +} + +void Level::RenderSelected( void ) +{ + for(int i=tileXmin; i<=tileXmax; i++) + { + for(int j=tileYmin; j<=tileYmax; j++) + { + azrp_image_p8( i*16, j*16, &img_selected, DIMAGE_NONE ); + } + } +} + + +void Level::Update( float dt ) +{ + +} + + + + +int Level::GetTileBackground( uint8_t x, uint8_t y ) +{ + uint8_t tileX = x / 16; + uint8_t tileY = y / 16; + + uint16_t index = tileY * map_level->w + tileX % map_level->w; + uint16_t currentTile = map_level->layers[0][ index ]; + return currentTile; +} + + +int Level::GetTileForeground( uint8_t x, uint8_t y ) +{ + uint8_t tileX = x / 16; + uint8_t tileY = y / 16; + + uint16_t index = tileY * map_level->w + tileX; + uint16_t currentTile = map_level->layers[1][ index ]; + return currentTile; +} + + +bool Level::CanGo( Player *MyPlayer ) +{ + int tileX, tileY; + int tileIndex, tileValue; + + int xmin = (int) MyPlayer->nextx - 8; + int ymin = (int) MyPlayer->nexty - 8; + int xmax = (int) MyPlayer->nextx + 8; + int ymax = (int) MyPlayer->nexty + 8; + +/* + tileXmin = xmin / 16; + tileXmax = xmax / 16; + tileYmin = ymin / 16; + tileYmax = ymax / 16; + + XinTile = xmin % 16; + YinTile = ymin % 16; +*/ + + if ((MyPlayer->action == RUN || MyPlayer->action == WALK) && MyPlayer->direction == LEFT) + { + if( GetTileBackground( xmin, ymin ) != 0 || GetTileBackground( xmin, ymax ) != 0) return false; + } + else if ((MyPlayer->action == RUN || MyPlayer->action == WALK) && MyPlayer->direction == RIGHT) + { + if( GetTileBackground( xmax, ymax ) != 0 || GetTileBackground( xmin, ymax ) != 0) return false; + } + else if (MyPlayer->action == JUMP) + { + if( GetTileBackground( xmin, ymin ) != 0 || GetTileBackground( xmax, ymin ) != 0) return false; + } + else if (MyPlayer->action == FALL) + { + if( GetTileBackground( xmin, ymax ) != 0 || GetTileBackground( xmax, ymax ) != 0) return false; + } + + return true; +} \ No newline at end of file diff --git a/src/background.h b/src/level.h similarity index 71% rename from src/background.h rename to src/level.h index 74eeff7..90e934d 100644 --- a/src/background.h +++ b/src/level.h @@ -25,19 +25,24 @@ struct Map { }; -class Background +class Level { public: - Background( ); - ~Background( ); + Level( ); + ~Level( ); void Update( float dt ); - void Render( ); + void Render( void ); + void RenderSelected( void ); void ChangeMap( int level, Player *MyPlayer ); void UpdateDataMap( Player *MyPlayer ); bool CanGo( Player *MyPlayer ); + + private: + int GetTileBackground( uint8_t x, uint8_t y ); + int GetTileForeground( uint8_t x, uint8_t y ); }; diff --git a/src/main.cpp b/src/main.cpp index 17b2d42..74fb578 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,14 +27,14 @@ #include "utilities.h" #include "player.h" -#include "background.h" +#include "level.h" bool screenshot = false; bool record = false; bool textoutput = false; bool exitToOS = false; -uint8_t texttodraw=1; +uint8_t texttodraw=2; #define SCALE_PIXEL 1 @@ -53,7 +53,7 @@ kmalloc_gint_stats_t *extram_stats; KeyboardExtra MyKeyboard; -Background MyBackground; +Level MyLevel; Player MyPlayer( 198, 180 ); @@ -95,24 +95,25 @@ static void hook_prefrag(int id, void *fragment, int size) static void update( float dt ) { - MyPlayer.Update( dt, 0.0f, 1.0f ); + MyPlayer.Update( dt ); } static void render( void ) { - MyBackground.Render(); + MyLevel.Render(); +// MyLevel.RenderSelected(); MyPlayer.Render(); #if(BIAS) - if (texttodraw>=1) Azur_draw_text(1,01, "FPS = %.0f", (float) (1000000.0f / elapsedTime) ); + if (texttodraw>=1) Azur_draw_text(1,01, "FPS = %.0f", (float) (1000.0f / elapsedTime) ); //if (texttodraw>=1) Azur_draw_text(1,11, "Part.= %d - Bull.= %d", MyParticles.size(), MyPlayerBullets.size() ); //if (texttodraw>=1 && !MyEnemies.empty()) Azur_draw_text(1,21, "Ennmy Life= %d", MyEnemies[0]->life ); if (texttodraw>=2) Azur_draw_text(1,31, "Update = %.3f ms", (float) time_update / 1000.0f ); if (texttodraw>=2) Azur_draw_text(1,41, "Render = %.3f ms", (float) time_render / 1000.0f ); - if (texttodraw>=2) Azur_draw_text(1,51, ">Total = %.0f ms", (float) elapsedTime / 1000.0f ); + if (texttodraw>=2) Azur_draw_text(1,51, ">Total = %.0f ms", (float) elapsedTime ); if (texttodraw>=3) Azur_draw_text(1,81, "Mem Used : %d", _uram_stats->used_memory + extram_stats->used_memory); if (texttodraw>=3) Azur_draw_text(1,91, "Mem Free : %d", _uram_stats->free_memory + extram_stats->free_memory); @@ -129,23 +130,23 @@ static void get_inputs( float dt ) #if(DEBUG_MODE) - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_7) && usb_is_open() ) {screenshot = true;}; - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_8) && usb_is_open()) {record = true; }; - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_9) && usb_is_open()) {record = false; }; + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_7) && usb_is_open() ) {screenshot = true;}; + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_8) && usb_is_open() ) {record = true; }; + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_9) && usb_is_open() ) {record = false; }; - if(MyKeyboard.IsKeyPressedEvent(MYKEY_VARS)) { drawbackground = !drawbackground; } + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_VARS) ) { drawbackground = !drawbackground; } - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) { texttodraw = 0; } - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) { texttodraw = 1; } - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) { texttodraw = 2; } - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) { texttodraw = 3; } + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_F1) ) { texttodraw = 0; } + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_F2) ) { texttodraw = 1; } + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_F3) ) { texttodraw = 2; } + if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_F4) ) { texttodraw = 3; } - if(MyKeyboard.IsKeyPressedEvent(MYKEY_F1)) { MyBackground.ChangeMap(1, &MyPlayer); } - if(MyKeyboard.IsKeyPressedEvent(MYKEY_F2)) { MyBackground.ChangeMap(2, &MyPlayer); } - if(MyKeyboard.IsKeyPressedEvent(MYKEY_F3)) { MyBackground.ChangeMap(3, &MyPlayer); } - if(MyKeyboard.IsKeyPressedEvent(MYKEY_F4)) { MyBackground.ChangeMap(4, &MyPlayer); } - if(MyKeyboard.IsKeyPressedEvent(MYKEY_F5)) { MyBackground.ChangeMap(5, &MyPlayer); } - if(MyKeyboard.IsKeyPressedEvent(MYKEY_F6)) { MyBackground.ChangeMap(6, &MyPlayer); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F1) ) { MyLevel.ChangeMap(1, &MyPlayer); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F2) ) { MyLevel.ChangeMap(2, &MyPlayer); } + if( MyKeyboard.IsKeyPressedEvent(MYKEY_F3) ) { MyLevel.ChangeMap(3, &MyPlayer); } +// if( MyKeyboard.IsKeyPressedEvent(MYKEY_F4) ) { MyLevel.ChangeMap(4, &MyPlayer); } +// if( MyKeyboard.IsKeyPressedEvent(MYKEY_F5) ) { MyLevel.ChangeMap(5, &MyPlayer); } +// if( MyKeyboard.IsKeyPressedEvent(MYKEY_F6) ) { MyLevel.ChangeMap(6, &MyPlayer); } #endif @@ -170,7 +171,7 @@ static void get_inputs( float dt ) MyPlayer.No_Order( dt ); } - if(MyKeyboard.IsKeyPressed(MYKEY_SHIFT)) + if(MyKeyboard.IsKeyPressedEvent(MYKEY_SHIFT)) { MyPlayer.Jump( dt ); } @@ -256,6 +257,9 @@ int main(void) usb_interface_t const *interfaces[] = { &usb_ff_bulk, NULL }; usb_open(interfaces, GINT_CALL_NULL); + + //MyLevel.ChangeMap(2, &MyPlayer); + prof_init(); do @@ -269,7 +273,7 @@ int main(void) get_inputs( elapsedTime ); - update( elapsedTime ); +// update( elapsedTime ); // update the RAM consumption status _uram_stats = kmalloc_get_gint_stats(_uram); @@ -292,7 +296,7 @@ int main(void) prof_leave(perf_render); time_render = prof_time(perf_render); - elapsedTime = ((float) (time_update+time_render)); + elapsedTime = ((float) (time_update+time_render)) / 1000.0f ; } while (exitToOS==false); diff --git a/src/player.cpp b/src/player.cpp index 5bfd271..69e9323 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -1,7 +1,7 @@ #include "player.h" #include #include -#include "background.h" +#include "level.h" /* extern bopti_image_t img_walking; @@ -9,27 +9,41 @@ extern bopti_image_t img_running; extern bopti_image_t img_static; */ -extern bopti_image_t img_rectangle; - +extern bopti_image_t img_circle; static uint32_t framecounter = 0; -extern Background MyBackground; +extern Level MyLevel; + +#define SPEEDWALK 6.0f +#define SPEEDRUN 12.0f +#define SPEEDSTATIC 0.0f + +#define SPEEDJUMPWALK 4.0f +#define SPEEDJUMPRUN 12.0f +#define SPEEDJUMPSTATIC 8.0f + +#define MAXFALLSPEED 20.0f Player::Player( int16_t _x, int16_t _y ) { - x = libnum::num(_x); - y = libnum::num(_y); + this->x = _x; + this->y = _y; - width = 8; - height = 8; - speed = 10; + this->vx = 0.0f; + this->vy = 0.0f; - xmin = (int) x - width; - xmax = (int) x + width; - ymin = (int) y - height; - ymax = (int) y + height; + this->ax = 0.0f; + this->ay = 1.0f; + + this->width = 8; + this->height = 8; + + this->xmin = (int) this->x - this->width; + this->xmax = (int) this->x + this->width; + this->ymin = (int) this->y - this->height; + this->ymax = (int) this->y + this->height; last_tick = rtc_ticks(); } @@ -40,21 +54,48 @@ Player::~Player() } -void Player::Update( float dt, libnum::num ax, libnum::num ay ) -{ - libnum::num DeltaTime = libnum::num( dt / 60000.0f ); - vx += ax * DeltaTime; - vy += ay * DeltaTime; - libnum::num xtemp = x + vx * DeltaTime; - libnum::num ytemp = y + vy * DeltaTime; - - if (MyBackground.CanGo( this )) + + +void Player::Update( float dt ) +{ + float DeltaTime = dt / 100.0f ; + + //this->vx += this->ax * DeltaTime; // horizontal acceleration not considered (yet) + this->vy += this->ay * DeltaTime; + + if (this->vy >= MAXFALLSPEED) this->vy = MAXFALLSPEED; + + // we were jumping and are reaching the top of the curve or even starting falling + if (this->action == JUMP && this->vy >= 0) { - x = xtemp; - y = ytemp; + this->action = FALL; } + + this->nextx = this->x + this->vx * DeltaTime; + this->nexty = this->y + this->vy * DeltaTime; + + bool testdestination = MyLevel.CanGo( this ); // true if we can go to the planed position + + if (testdestination) + { + this->x = this->nextx; + this->y = this->nexty; + } + else if(this->action == JUMP) + { + this->vx = 0; + this->vy = 0; + this->action = FALL; + } + else + { + this->vx = 0; + this->vy = 0; + this->action = STATIC; + } + xmin = (int) x - width; xmax = (int) x + width; ymin = (int) y - height; @@ -88,87 +129,111 @@ void Player::Render( void ) } */ - azrp_image_p8_effect(xmin, ymin, &img_rectangle, DIMAGE_NONE); + azrp_image_p8_effect(xmin, ymin, &img_circle, DIMAGE_NONE); } -void Player::Set_Speed( uint8_t _sp ) -{ - speed = _sp; -} void Player::Walk_Left( float dt ) -{ - libnum::num a = libnum::num( dt / 60000.0f ); - - x -= a * libnum::num( speed/3 ); +{ + this->vx = SPEEDWALK * -1.0f; this->direction = LEFT; this->action = WALK; + + this->Update( dt ); } void Player::Walk_Right( float dt ) { - libnum::num a = libnum::num( dt / 60000.0f ); - - x += a * libnum::num( speed/3 ); - + this->vx = SPEEDWALK * 1.0f; this->direction = RIGHT; this->action = WALK; + + this->Update( dt ); } void Player::Run_Left( float dt ) { - libnum::num a = libnum::num( dt / 60000.0f ); - - x -= a * libnum::num( speed ); - + this->vx = SPEEDRUN * -1.0f; this->direction = LEFT; this->action = RUN; + + this->Update( dt ); } void Player::Run_Right( float dt ) { - libnum::num a = libnum::num( dt / 60000.0f ); - - x += a * libnum::num( speed ); + this->vx = SPEEDRUN * 1.0f; this->direction = RIGHT; this->action = RUN; + + this->Update( dt ); } void Player::Jump( float dt ) { - if (this->action==WALK) + // check if we are already jumping or not + if (this->action != JUMP && this->action != FALL) // not in a jump or in a fall { - //this->vx = speed / 3; - this->vy = -speed / 2; + if (this->action==WALK) + { + this->vy = SPEEDJUMPWALK * -1.0f; + } + else if (this->action==RUN) + { + this->vy = SPEEDJUMPRUN * -1.0f; + } + else + { + this->vy = SPEEDJUMPSTATIC * -1.0f; + } } - else if (this->action==RUN) + else if (this->action == FALL) // descending phase (FALL) of a jump, we can start a new small jump { - //this->vx = speed; - this->vy = -speed; + this->vy = SPEEDJUMPSTATIC * -1.0f; } else { - //this->vx = 0; - this->vy = -speed /2; + } - this->direction = LEFT; - this->action = JUMP; - - if (this->direction==LEFT) - { - this->vx = -this->vx; - } + this->Update( dt ); } void Player::No_Order( float dt ) { +/* if (this->action == RUN || this->action == WALK) { - this->action == BREAK; - } + this->action = BREAK; + } + + if (this->direction == LEFT) // we were going LEFT and we stop moving to the left so we decrease speed till reaching static + { + this->vx += 1; + if (vx>=0) + { + this->vx = 0; + this->action = STATIC; + this->direction = STATIC; + } + } + else if (this->direction == RIGHT) // we were going RIGHT and we stop moving to the left so we decrease speed till reaching static + { + this->vx -= 1; + if (vx<=0) + { + this->vx = 0; + this->action = STATIC; + this->direction = STATIC; + } + } + + this->Update( 0.0f, 0.0, 0.0 ); +*/ + + this->Update( dt ); } diff --git a/src/player.h b/src/player.h index d40b56b..6f78daa 100644 --- a/src/player.h +++ b/src/player.h @@ -29,7 +29,7 @@ class Player Player( int16_t _x, int16_t _y ); ~Player(); - void Update( float dt, libnum::num ax, libnum::num ay ); + void Update( float dt ); void Render( ); void Walk_Left( float dt ); @@ -42,21 +42,15 @@ class Player void Jump( float dt ); - - void Go_Up( int action, float dt ); - void Go_Down( int action, float dt ); - - void Set_Speed( uint8_t _sp ); - - libnum::num x, y; // center position of the player - libnum::num vx, vy; // speed of the player as per x and y coordinates + float x, y; // center position of the player + float nextx, nexty; // interim x and y position (to be tested to check if they can be actually achieved or not while moving) + float vx, vy; // speed of the player as per x and y coordinates + float ax, ay; // acceleration of the player as per x an y coordinates uint8_t width, height; // width and height - for the hitbox int16_t xmin, xmax, ymin, ymax; // square hitbox (to speed up the impact calculations) - int16_t life; - uint8_t speed; // speed of the player uint32_t last_tick; int8_t direction = STATIC;