Compare commits

...

2 Commits

Author SHA1 Message Date
Sylvain PILLOT 6ea6e9fbe5 corrected bug in tile numbering in converter.py 2023-05-06 22:35:15 +02:00
Sylvain PILLOT f705226e1e cleaning 2023-05-03 22:50:46 +02:00
21 changed files with 743 additions and 305 deletions

View File

@ -20,17 +20,23 @@ add_custom_command(
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/
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level0.json"
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"
OUTPUT "${CMAKE_CURRENT_LIST_DIR}/assets-cg/levels/level4.json"
DEPENDS assets-cg/converters.py
assets-cg/levels/tileset.png
assets-cg/levels/tilesetnpp.tsx
assets-cg/levels/level0.tmx
assets-cg/levels/level1.tmx
assets-cg/levels/level2.tmx
assets-cg/levels/level2.tmx)
assets-cg/levels/level3.tmx
assets-cg/levels/level4.tmx
)
set(SOURCES
src/vector2D.cpp
src/main.cpp
src/extrakeyboard.cpp
src/utilities.cpp
@ -54,9 +60,11 @@ set(ASSETS_cg
assets-cg/sprites/selected.png
assets-cg/levels/tileset.png
assets-cg/levels/level0.json
assets-cg/levels/level1.json
assets-cg/levels/level2.json
assets-cg/levels/level3.json
assets-cg/levels/level4.json
# ...
)

View File

@ -47,7 +47,7 @@ def convert_map(input, output, params, target):
layer_data = bytes()
layer = data["layers"][i]
for tile in layer["data"]:
layer_data += fxconv.u16(tile)
layer_data += fxconv.u16(tile-1)
structMap += fxconv.ptr(layer_data)

View File

@ -0,0 +1,44 @@
{ "compressionlevel":-1,
"height":14,
"infinite":false,
"layers":[
{
"data":[1, 1, 47, 1, 1, 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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],
"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
}

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="25" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="tilesetnpp.tsx"/>
<layer id="1" name="Background" width="25" height="14">
<data encoding="csv">
1,1,47,1,1,1,1,1,1,1,1,47,1,1,1,3,4,1,1,1,1,3,4,1,1,
1,3,0,4,1,1,1,1,1,1,3,0,4,47,50,0,0,49,47,47,50,0,0,49,1,
46,0,0,0,4,1,1,1,1,46,0,0,22,0,0,0,0,0,22,0,0,0,0,0,4,
46,0,0,0,0,4,1,1,1,46,0,0,22,0,0,0,0,0,22,0,0,0,0,0,14,
46,0,0,0,0,0,4,1,1,46,0,0,0,39,40,0,0,39,45,45,40,0,0,39,1,
46,0,0,0,0,0,0,4,1,46,0,0,0,48,1,13,14,1,1,1,1,13,14,1,1,
46,0,0,0,0,0,0,0,4,50,0,0,0,48,1,1,1,1,1,1,1,1,1,1,1,
46,0,0,0,39,13,0,0,0,0,0,0,0,48,1,1,1,1,1,1,1,1,1,1,1,
46,0,0,0,48,1,13,0,0,0,0,0,0,48,1,1,1,1,1,1,1,1,1,1,1,
46,0,0,0,48,1,1,13,0,0,0,0,0,48,1,1,1,1,1,1,1,1,1,1,1,
46,0,0,0,48,1,1,1,13,0,0,0,0,48,1,1,1,1,1,1,1,1,1,1,1,
46,0,0,0,48,1,1,1,1,13,0,0,0,48,1,1,1,1,1,1,1,1,1,1,1,
1,13,0,14,1,1,1,1,1,1,13,0,14,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,45,1,1,1,1,1,1,1,1,45,1,1,1,1,1,1,1,1,1,1,1,1,1
</data>
</layer>
<layer id="2" name="Foreground" width="25" height="14">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,24,0,0,0,0,0,0,0,0,24,0,0,0,23,34,0,0,0,0,0,34,0,0,
0,23,0,0,0,0,0,0,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,23,0,0,0,0,0,0,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,31,0,
0,23,0,0,0,0,0,0,0,0,23,0,0,0,0,23,34,0,0,0,0,0,34,0,0,
0,23,0,0,0,0,0,0,0,0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,23,0,0,32,0,0,0,0,0,23,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,42,42,42,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,41,0,0,0,0,0,0,0,42,42,42,0,0,0,0,0,0,0,0,0,0,0,0,
0,11,11,11,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
</data>
</layer>
</map>

View File

@ -3,7 +3,7 @@
"infinite":false,
"layers":[
{
"data":[2, 2, 2, 2, 2, 2, 2, 2,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45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1],
"height":14,
"id":1,
"name":"Background",
@ -21,7 +21,7 @@
"name":"Foreground",
"opacity":1,
"type":"tilelayer",
"visible":false,
"visible":true,
"width":25,
"x":0,
"y":0

View File

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="25" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<map version="1.8" tiledversion="1.8.0" orientation="orthogonal" renderorder="right-down" width="25" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="tilesetnpp.tsx"/>
<layer id="1" name="Background" width="25" height="14">
<data encoding="csv">
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,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,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
1,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,1,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
1,29,29,29,29,29,29,9,0,0,0,0,0,0,0,0,0,20,29,29,29,29,29,29,1,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,20,29,29,29,9,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,20,29,29,9,0,0,0,0,0,0,0,0,0,0,0,20,29,29,9,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,
1,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1
</data>
</layer>
<layer id="2" name="Foreground" width="25" height="14" visible="0">
<layer id="2" name="Foreground" width="25" height="14">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

View File

@ -3,7 +3,7 @@
"infinite":false,
"layers":[
{
"data":[2, 2, 2, 2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 2, 2, 2, 2, 2],
"data":[1, 1, 1, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 1, 1, 1, 1, 1, 3, 0, 0, 0, 0, 4, 1, 1, 1, 1, 47, 1, 1, 1, 1, 3, 0, 0, 0, 0, 4, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 4, 47, 5, 6, 0, 7, 8, 47, 3, 0, 0, 0, 0, 0, 0, 4, 1, 46, 0, 0, 14, 45, 45, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 45, 45, 13, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 17, 18, 45, 15, 16, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 48, 1, 47, 1, 46, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 46, 0, 0, 0, 48, 3, 0, 4, 46, 0, 0, 0, 48, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 1, 13, 0, 14, 46, 0, 0, 0, 48, 13, 0, 14, 1, 1, 1, 46, 0, 0, 48, 46, 0, 0, 48, 1, 1, 1, 1, 45, 1, 46, 0, 2, 0, 48, 1, 45, 1, 1, 1, 1, 46, 0, 0, 48, 46, 0, 0, 4, 47, 47, 47, 47, 47, 5, 6, 0, 0, 0, 7, 8, 47, 47, 47, 47, 47, 3, 0, 0, 48, 1, 13, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 14, 1, 1, 1, 13, 0, 21, 0, 0, 0, 0, 0, 17, 18, 45, 15, 16, 0, 0, 0, 0, 0, 21, 0, 14, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1],
"height":14,
"id":1,
"name":"Background",

View File

@ -3,20 +3,20 @@
<tileset firstgid="1" source="tilesetnpp.tsx"/>
<layer id="1" name="Background" width="25" height="14">
<data encoding="csv">
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,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,17,18,2,15,16,0,0,0,2,2,2,2,0,0,2,
2,0,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,0,4,2,0,0,0,2,2,2,2,0,0,2,
2,0,0,2,2,2,2,13,0,14,2,0,0,0,2,13,0,14,2,2,2,2,0,0,2,
2,0,0,2,2,2,2,2,2,2,2,0,2,0,2,2,2,2,2,2,2,2,0,0,2,
2,0,0,4,2,2,2,2,2,5,6,0,2,0,7,8,2,2,2,2,2,3,0,0,2,
2,13,0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,14,2,
2,2,13,0,21,0,0,0,0,0,17,18,2,15,16,0,0,0,0,0,21,0,14,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
1,1,1,47,47,47,47,1,1,1,1,1,1,1,1,1,1,1,47,47,47,47,1,1,1,
1,1,3,0,0,0,0,4,1,1,1,1,47,1,1,1,1,3,0,0,0,0,4,1,1,
1,3,0,0,0,0,0,0,4,47,5,6,0,7,8,47,3,0,0,0,0,0,0,4,1,
46,0,0,14,45,45,13,0,0,0,0,0,0,0,0,0,0,0,14,45,45,13,0,0,48,
46,0,0,48,1,1,46,0,0,0,0,0,0,0,0,0,0,0,48,1,1,46,0,0,48,
46,0,0,48,1,1,46,0,0,0,17,18,45,15,16,0,0,0,48,1,1,46,0,0,48,
46,0,0,48,1,1,46,0,0,0,48,1,47,1,46,0,0,0,48,1,1,46,0,0,48,
46,0,0,48,1,1,46,0,0,0,48,3,0,4,46,0,0,0,48,1,1,46,0,0,48,
46,0,0,48,1,1,1,13,0,14,46,0,0,0,48,13,0,14,1,1,1,46,0,0,48,
46,0,0,48,1,1,1,1,45,1,46,0,2,0,48,1,45,1,1,1,1,46,0,0,48,
46,0,0,4,47,47,47,47,47,5,6,0,0,0,7,8,47,47,47,47,47,3,0,0,48,
1,13,0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,0,0,14,1,
1,1,13,0,21,0,0,0,0,0,17,18,45,15,16,0,0,0,0,0,21,0,14,1,1,
1,1,1,45,45,45,45,45,45,45,1,1,1,1,1,45,45,45,45,45,45,45,1,1,1
</data>
</layer>
<layer id="2" name="Foreground" width="25" height="14">

View File

@ -3,19 +3,19 @@
"infinite":false,
"layers":[
{
"data":[0, 0, 0, 0, 17, 18, 2, 2, 15, 16, 0, 0, 0, 0, 0, 17, 18, 2, 2, 15, 16, 0, 0, 0, 0, 0, 0, 0, 14, 5, 6, 22, 0, 7, 8, 15, 16, 0, 17, 18, 5, 6, 22, 0, 7, 8, 13, 0, 0, 0, 0, 0, 14, 3, 0, 0, 22, 0, 0, 0, 4, 2, 2, 2, 3, 0, 0, 22, 0, 0, 0, 4, 13, 0, 0, 0, 14, 3, 0, 0, 0, 22, 0, 0, 0, 0, 26, 2, 25, 0, 0, 0, 22, 0, 0, 0, 0, 4, 13, 0, 28, 25, 0, 0, 0, 0, 2, 2, 0, 0, 0, 36, 2, 35, 0, 0, 0, 2, 2, 0, 0, 0, 0, 26, 27, 38, 35, 0, 0, 17, 18, 2, 2, 27, 0, 0, 0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, 0, 0, 17, 18, 1, 1, 27, 0, 0, 0, 19, 0, 0, 0, 28, 1, 1, 15, 16, 0, 0, 36, 37, 30, 0, 0, 14, 1, 1, 1, 1, 37, 0, 0, 0, 0, 0, 0, 0, 38, 1, 1, 1, 1, 13, 0, 0, 30, 30, 0, 0, 4, 1, 1, 1, 1, 1, 15, 16, 0, 0, 0, 17, 18, 1, 1, 1, 1, 1, 3, 0, 0, 30, 26, 27, 0, 0, 7, 8, 1, 1, 1, 1, 47, 29, 29, 29, 47, 1, 1, 1, 1, 5, 6, 0, 0, 28, 25, 36, 37, 0, 0, 0, 0, 4, 47, 5, 6, 0, 0, 0, 0, 0, 7, 8, 47, 3, 0, 0, 0, 0, 38, 35, 0, 4, 13, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 14, 3, 0, 0, 0, 4, 13, 0, 0, 0, 21, 0, 0, 14, 45, 29, 45, 13, 0, 0, 21, 0, 0, 0, 14, 3, 0, 0, 0, 0, 0, 4, 15, 16, 0, 21, 17, 18, 5, 6, 0, 7, 8, 15, 16, 21, 0, 17, 18, 3, 0, 0, 0, 0, 0, 0, 0, 7, 8, 29, 29, 5, 6, 0, 0, 0, 0, 0, 7, 8, 29, 29, 5, 6, 0, 0, 0, 0],
"height":14,
"id":1,
"name":"Background",
"opacity":1,
"type":"tilelayer",
"visible":false,
"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, 42, 0, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0,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 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 0, 0, 42, 31, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 42, 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, 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, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 32, 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],
"height":14,
"id":2,
"name":"Foreground",

View File

@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="25" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="tilesetnpp.tsx"/>
<layer id="1" name="Background" width="25" height="14" visible="0">
<layer id="1" name="Background" width="25" height="14">
<data encoding="csv">
0,0,0,0,17,18,2,2,15,16,0,0,0,0,0,17,18,2,2,15,16,0,0,0,0,
0,0,0,0,17,18,29,29,15,16,0,0,0,0,0,17,18,29,29,15,16,0,0,0,0,
0,0,0,14,5,6,22,0,7,8,15,16,0,17,18,5,6,22,0,7,8,13,0,0,0,
0,0,14,3,0,0,22,0,0,0,4,2,2,2,3,0,0,22,0,0,0,4,13,0,0,
0,14,3,0,0,0,22,0,0,0,0,26,2,25,0,0,0,22,0,0,0,0,4,13,0,
28,25,0,0,0,0,2,2,0,0,0,36,2,35,0,0,0,2,2,0,0,0,0,26,27,
38,35,0,0,17,18,2,2,27,0,0,0,2,0,0,0,28,2,2,15,16,0,0,36,37,
2,0,0,14,2,2,2,2,37,0,0,0,0,0,0,0,38,2,2,2,2,13,0,0,2,
2,0,0,4,2,2,2,2,2,15,16,0,0,0,17,18,2,2,2,2,2,3,0,0,2,
26,27,0,0,7,8,2,2,2,2,2,2,2,2,2,2,2,2,2,5,6,0,0,28,25,
36,37,0,0,0,0,4,2,5,6,0,0,0,0,0,7,8,2,3,0,0,0,0,38,35,
0,4,13,0,0,0,0,21,0,0,0,14,2,13,0,0,0,21,0,0,0,0,14,3,0,
0,0,4,13,0,0,0,21,0,0,14,2,2,2,13,0,0,21,0,0,0,14,3,0,0,
0,0,14,3,0,0,22,0,0,0,4,1,1,1,3,0,0,22,0,0,0,4,13,0,0,
0,14,3,0,0,0,22,0,0,0,0,26,1,25,0,0,0,22,0,0,0,0,4,13,0,
28,25,0,0,0,0,39,40,0,0,0,36,1,35,0,0,0,39,40,0,0,0,0,26,27,
38,35,0,0,17,18,1,1,27,0,0,0,19,0,0,0,28,1,1,15,16,0,0,36,37,
30,0,0,14,1,1,1,1,37,0,0,0,0,0,0,0,38,1,1,1,1,13,0,0,30,
30,0,0,4,1,1,1,1,1,15,16,0,0,0,17,18,1,1,1,1,1,3,0,0,30,
26,27,0,0,7,8,1,1,1,1,47,29,29,29,47,1,1,1,1,5,6,0,0,28,25,
36,37,0,0,0,0,4,47,5,6,0,0,0,0,0,7,8,47,3,0,0,0,0,38,35,
0,4,13,0,0,0,0,21,0,0,0,0,0,0,0,0,0,21,0,0,0,0,14,3,0,
0,0,4,13,0,0,0,21,0,0,14,45,29,45,13,0,0,21,0,0,0,14,3,0,0,
0,0,0,4,15,16,0,21,17,18,5,6,0,7,8,15,16,21,0,17,18,3,0,0,0,
0,0,0,0,7,8,2,2,5,6,0,0,0,0,0,7,8,2,2,5,6,0,0,0,0
0,0,0,0,7,8,29,29,5,6,0,0,0,0,0,7,8,29,29,5,6,0,0,0,0
</data>
</layer>
<layer id="2" name="Foreground" width="25" height="14">
@ -30,8 +30,8 @@
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,0,0,0,0,41,0,0,0,0,0,0,0,0,0,42,0,0,
0,0,0,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,0,0,0,
0,0,0,0,42,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,42,0,0,0,0,
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,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,0,0,0,0,
0,0,0,0,0,42,0,0,0,0,0,0,32,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

View File

@ -0,0 +1,44 @@
{ "compressionlevel":-1,
"height":14,
"infinite":false,
"layers":[
{
"data":[1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 1, 1, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 25, 0, 0, 0, 0, 0, 0, 0, 17, 18, 27, 0, 28, 15, 16, 0, 0, 0, 0, 0, 0, 0, 26, 1, 1, 35, 0, 0, 0, 0, 0, 0, 14, 1, 1, 37, 0, 38, 1, 1, 13, 0, 0, 0, 0, 0, 0, 36, 1, 46, 0, 0, 0, 0, 0, 0, 28, 1, 1, 5, 6, 0, 7, 8, 1, 1, 27, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 38, 1, 25, 0, 0, 0, 0, 0, 26, 1, 37, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 26, 1, 35, 0, 0, 0, 0, 0, 36, 1, 25, 0, 0, 0, 0, 0, 0, 48, 46, 0, 0, 0, 0, 0, 0, 36, 1, 13, 0, 0, 0, 0, 0, 14, 1, 35, 0, 0, 0, 0, 0, 0, 48, 1, 27, 0, 0, 0, 0, 0, 0, 4, 1, 13, 0, 0, 0, 14, 1, 3, 0, 0, 0, 0, 0, 0, 28, 1, 1, 37, 0, 0, 0, 0, 0, 0, 0, 7, 8, 29, 29, 29, 5, 6, 0, 0, 0, 0, 0, 0, 0, 38, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 1, 1, 1, 1, 1, 1, 1, 1, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1, 1, 1],
"height":14,
"id":2,
"name":"Background",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":25,
"x":0,
"y":0
},
{
"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, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":14,
"id":1,
"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
}

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.8.0" orientation="orthogonal" renderorder="right-down" width="25" height="14" tilewidth="16" tileheight="16" infinite="0" nextlayerid="3" nextobjectid="1">
<tileset firstgid="1" source="tilesetnpp.tsx"/>
<layer id="2" name="Background" width="25" height="14">
<data encoding="csv">
1,1,1,1,1,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,1,1,1,1,1,
1,1,1,5,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,8,1,1,1,
1,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,1,
1,25,0,0,0,0,0,0,0,17,18,27,0,28,15,16,0,0,0,0,0,0,0,26,1,
1,35,0,0,0,0,0,0,14,1,1,37,0,38,1,1,13,0,0,0,0,0,0,36,1,
46,0,0,0,0,0,0,28,1,1,5,6,0,7,8,1,1,27,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,38,1,25,0,0,0,0,0,26,1,37,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,26,1,35,0,0,0,0,0,36,1,25,0,0,0,0,0,0,48,
46,0,0,0,0,0,0,36,1,13,0,0,0,0,0,14,1,35,0,0,0,0,0,0,48,
1,27,0,0,0,0,0,0,4,1,13,0,0,0,14,1,3,0,0,0,0,0,0,28,1,
1,37,0,0,0,0,0,0,0,7,8,29,29,29,5,6,0,0,0,0,0,0,0,38,1,
1,1,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,1,1,
1,1,1,15,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,18,1,1,1,
1,1,1,1,1,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1,1,1,1,1
</data>
</layer>
<layer id="1" name="Foreground" width="25" height="14">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,24,24,24,0,0,31,0,0,24,24,24,0,0,0,0,0,0,0,
0,0,0,0,0,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,42,42,42,0,0,0,0,
0,0,0,0,42,42,42,0,0,0,0,0,0,0,0,0,0,0,42,42,42,0,0,0,0,
0,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,
0,23,0,0,0,0,0,0,0,0,43,0,0,0,43,0,0,0,0,0,0,0,0,34,0,
0,23,0,0,0,0,0,0,0,0,43,0,0,0,43,0,0,0,0,0,0,0,0,34,0,
0,23,0,0,42,42,42,0,0,0,43,0,0,0,43,0,0,0,42,42,42,0,0,34,0,
0,0,0,0,42,42,42,0,0,0,0,0,41,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,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
</data>
</layer>
</map>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -10,11 +10,16 @@
#define TILESIZE 16
extern struct Map map_level0;
extern struct Map map_level1;
extern struct Map map_level2;
extern struct Map map_level3;
extern struct Map map_level4;
extern bool drawbackground;
extern bool textbacktile;
extern bool textforetile;
struct Map *map_level;
@ -38,10 +43,12 @@ Level::~Level( )
void Level::ChangeMap( int level, Player *MyPlayer )
{
if(level==1) map_level = &map_level1;
if(level==0) map_level = &map_level0;
else 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;
else if(level==4) map_level = &map_level4;
else map_level = &map_level0;
this->UpdateDataMap( MyPlayer );
}
@ -54,12 +61,14 @@ void Level::UpdateDataMap( Player *MyPlayer )
{
uint16_t index = j * map_level->w + i;
uint16_t currentTile = map_level->layers[1][ index ];
if (currentTile==32)
if (currentTile==31)
{
MyPlayer->x = (float) (i*16+8);
MyPlayer->y = (float) (j*16);
MyPlayer->currx = (float) (i) + 0.5f;
MyPlayer->curry = (float) (j) + 0.5f;
MyPlayer->vx = 0.0f;
MyPlayer->vy = 0.0f;
MyPlayer->Update( 0.0f );
}
}
@ -76,37 +85,26 @@ void Level::Render( void )
{
uint16_t index = j * map_level->w + i;
uint16_t currentTile = map_level->layers[u][ index ];
if (currentTile!=0) // && currentTile!=32)
if (currentTile!=-1)
{
uint16_t xtile = ((currentTile % map_level->tileset_size)-1) * 16;
uint16_t xtile = (currentTile % map_level->tileset_size) * 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
/*
if (u==0) Azur_draw_text( i*16+1, j*16+1, "%d", GetTileBackgroundINT( i, j ) );
else if (u==1) Azur_draw_text( i*16+1, j*16+1, "%d", GetTileForegroundINT( i, j ) );
*/
if (textbacktile) Azur_draw_text( i*16, j*16, "%d", GetTileBackgroundINT( i, j ) );
if (textforetile) Azur_draw_text( i*16+8, j*16+8, "%d", GetTileForegroundINT( i, j ) );
}
}
}
}
}
void Level::RenderSelected( void )
void Level::RenderSelected( uint8_t i, uint8_t j )
{
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 );
}
}
azrp_image_p8( i*16, j*16, &img_selected, DIMAGE_NONE );
Azur_draw_text( i*16+1, j*16+1, "B=%d", GetTileBackgroundINT( i, j ) );
Azur_draw_text( i*16+1, j*16+1, "F=%d", GetTileForegroundINT( i, j ) );
}
@ -115,7 +113,8 @@ void Level::Update( float dt )
}
/*RETURN the type of tile located in the background for the point x, y using player coordinates (x=[0..25], y=[0..14]) */
/*the x and y correspond to hte integer part of MyPlayer.x and MyPlayer.y*/
int Level::GetTileBackgroundINT( uint8_t x, uint8_t y )
{
uint16_t index = y * map_level->w + x;
@ -123,7 +122,8 @@ int Level::GetTileBackgroundINT( uint8_t x, uint8_t y )
return currentTile;
}
/*RETURN the type of tile located in the foreground for the point x, y using player coordinates (x=[0..25], y=[0..14]) */
/*the x and y correspond to hte integer part of MyPlayer.x and MyPlayer.y*/
int Level::GetTileForegroundINT( uint8_t x, uint8_t y )
{
uint16_t index = y * map_level->w + x;
@ -131,65 +131,46 @@ int Level::GetTileForegroundINT( uint8_t x, uint8_t y )
return currentTile;
}
int Level::GetTileBackground( uint8_t x, uint8_t y )
{
uint8_t tileX = x / 16;
uint8_t tileY = y / 16;
/*RETURN the type of tile located in the background for the point x, y using screen coordinates (x=[0..396], y=[0..223]) */
int Level::GetTileBackground( uint16_t x, uint16_t y )
{
uint8_t tileX = x >> 4;
uint8_t tileY = y >> 4;
uint16_t index = tileY * map_level->w + tileX;
uint16_t currentTile = map_level->layers[0][ index ];
return currentTile;
}
int Level::GetTileForeground( uint8_t x, uint8_t y )
/*RETURN the type of tile located in the foreground for the point x, y using screen coordinates (x=[0..396], y=[0..223]) */
int Level::GetTileForeground( uint16_t x, uint16_t y )
{
uint8_t tileX = x / 16;
uint8_t tileY = y / 16;
uint8_t tileX = x >> 4;
uint8_t tileY = y >> 4 ;
uint16_t index = tileY * map_level->w + tileX;
uint16_t currentTile = map_level->layers[1][ index ];
return currentTile;
}
/*RETURN true if the player can go in the target position*/
bool Level::CanGo( Player *MyPlayer )
{
int tileX, tileY;
int tileIndex, tileValue;
uint16_t targetTile = this->GetTileBackgroundINT( (int) MyPlayer->nextx, (int) MyPlayer->nexty );
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;
}
*/
if (targetTile!=0) return false;
return true;
}
/*RETURN true if the player is above a solid tile*/
/*TO DO : TO BE IMPROVED, THIS IS REALLY DIRTY !!!!*/
bool Level::IsOnGround( Player *MyPlayer )
{
if (this->GetTileBackgroundINT( (uint8_t) MyPlayer->currx, (uint8_t) MyPlayer->curry +1 ) !=0)
{
return true;
}
return false;
}

View File

@ -33,16 +33,17 @@ class Level
void Update( float dt );
void Render( void );
void RenderSelected( void );
void RenderSelected( uint8_t i, uint8_t j );
void ChangeMap( int level, Player *MyPlayer );
void UpdateDataMap( Player *MyPlayer );
bool CanGo( Player *MyPlayer );
bool IsOnGround( Player *MyPlayer );
private:
int GetTileBackground( uint8_t x, uint8_t y );
int GetTileForeground( uint8_t x, uint8_t y );
int GetTileBackground( uint16_t x, uint16_t y );
int GetTileForeground( uint16_t x, uint16_t y );
int GetTileBackgroundINT( uint8_t x, uint8_t y );
int GetTileForegroundINT( uint8_t x, uint8_t y );
};

View File

@ -28,14 +28,20 @@
#include "player.h"
#include "level.h"
#include "vector2D.h"
#include <vector>
bool screenshot = false;
bool record = false;
bool textoutput = false;
bool exitToOS = false;
uint8_t texttodraw=0;
uint8_t texttodraw=0;
bool textbacktile = false;
bool textforetile = false;
#define SCALE_PIXEL 1
#define X_RESOL (DWIDTH / SCALE_PIXEL)
@ -56,6 +62,8 @@ KeyboardExtra MyKeyboard;
Level MyLevel;
Player MyPlayer( 198, 180 );
std::vector<Border> MyLevelBorders;
bool drawbackground = true;
@ -134,41 +142,28 @@ static void get_inputs( float dt )
if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_VARS) ) { drawbackground = !drawbackground; }
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.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_0) ) { texttodraw = 0; }
if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_1) ) { texttodraw = 1; }
if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_2) ) { texttodraw = 2; }
if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_3) ) { texttodraw = 3; }
if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_4) ) { textbacktile = !textbacktile; }
if( MyKeyboard.IsKeyPressed(MYKEY_OPTN) && MyKeyboard.IsKeyPressedEvent(MYKEY_5) ) { textforetile = !textforetile; }
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_F1) ) { MyLevel.ChangeMap(0, &MyPlayer); }
if( MyKeyboard.IsKeyPressedEvent(MYKEY_F2) ) { MyLevel.ChangeMap(1, &MyPlayer); }
if( MyKeyboard.IsKeyPressedEvent(MYKEY_F3) ) { MyLevel.ChangeMap(2, &MyPlayer); }
if( MyKeyboard.IsKeyPressedEvent(MYKEY_F4) ) { MyLevel.ChangeMap(3, &MyPlayer); }
if( MyKeyboard.IsKeyPressedEvent(MYKEY_F5) ) { MyLevel.ChangeMap(4, &MyPlayer); }
if( MyKeyboard.IsKeyPressedEvent(MYKEY_F6) ) { MyLevel.ChangeMap(5, &MyPlayer); }
#endif
/*
if(MyKeyboard.IsKeyPressed(MYKEY_ALPHA) && MyKeyboard.IsKeyPressed(MYKEY_LEFT))
{
MyPlayer.Walk_Left( dt );
}
else if(MyKeyboard.IsKeyPressed(MYKEY_ALPHA) && MyKeyboard.IsKeyPressed(MYKEY_RIGHT))
{
MyPlayer.Walk_Right( dt );
}
else
*/
if(MyKeyboard.IsKeyPressed(MYKEY_LEFT))
{
MyPlayer.Run_Left( dt );
}
else if(MyKeyboard.IsKeyPressed(MYKEY_RIGHT))
{
MyPlayer.Run_Right( dt );
}
else
{
MyPlayer.No_Order( dt );
}
/* we can have either LEFT or RIGHT or NONE OF THEM pressed for the direction */
if(MyKeyboard.IsKeyPressed(MYKEY_LEFT)) MyPlayer.Left( dt );
else if(MyKeyboard.IsKeyPressed(MYKEY_RIGHT)) MyPlayer.Right( dt );
else MyPlayer.Nothing( dt );
/* JUMP is */
if(MyKeyboard.IsKeyPressedEvent(MYKEY_SHIFT))
{
MyPlayer.Jump( dt );
@ -256,6 +251,47 @@ int main(void)
usb_open(interfaces, GINT_CALL_NULL);
Border B1, B2, B3, B4;
B1.A.x = libnum::num( 50 );
B1.A.y = libnum::num( 210 );
B1.B.x = libnum::num( 250 );
B1.B.y = libnum::num( 210 );
B1.N.x = libnum::num( 0 );
B1.N.y = libnum::num( -1 );
B2.A.x = libnum::num( 250 );
B2.A.y = libnum::num( 210 );
B2.B.x = libnum::num( 250 );
B2.B.y = libnum::num( 10 );
B2.N.x = libnum::num( -1 );
B2.N.y = libnum::num( 0 );
B3.A.x = libnum::num( 250 );
B3.A.y = libnum::num( 10 );
B3.B.x = libnum::num( 50 );
B3.B.y = libnum::num( 10 );
B3.N.x = libnum::num( 0 );
B3.N.y = libnum::num( 1 );
B4.A.x = libnum::num( 50 );
B4.A.y = libnum::num( 10 );
B4.B.x = libnum::num( 50 );
B4.B.y = libnum::num( 210 );
B4.N.x = libnum::num( 1 );
B4.N.y = libnum::num( 0 );
MyLevelBorders.push_back( B1 );
MyLevelBorders.push_back( B2 );
MyLevelBorders.push_back( B3 );
MyLevelBorders.push_back( B4 );
//MyLevel.ChangeMap(2, &MyPlayer);
prof_init();
@ -268,7 +304,6 @@ int main(void)
{
// all the stuff to be update should be put here
MyKeyboard.Update( elapsedTime );
get_inputs( elapsedTime );
update( elapsedTime );
@ -287,7 +322,28 @@ int main(void)
{
// all the stuff to be rendered should be put here
azrp_clear( C_GREEN );
render();
for( int i=0; i<MyLevelBorders.size(); i++)
{
azrp_line( (int) MyLevelBorders[i].A.x, (int) MyLevelBorders[i].A.y,
(int) MyLevelBorders[i].B.x, (int) MyLevelBorders[i].B.y,
C_RED );
}
/*
azrp_clear( C_BLACK );
Azur_draw_text(1,01, "FPS = %.0f", (float) (1000.0f / elapsedTime) );
azrp_line( 10, 10, 100, 50, C_WHITE );
azrp_line( 100, 10, 100, 50, C_RED );
azrp_line( 10, 100, 100, 150, C_GREEN );
azrp_line( 100, 150, 200, 150, C_WHITE );
azrp_line( 200, 150, 300, 100, C_BLUE )
azrp_line( 10, 100, 350, 100, C_RED );
*/
azrp_update();
}

View File

@ -175,8 +175,8 @@ void Player::Run_Left( float dt )
{
this->vx -= 1.0f;
if ( this->vx <= SPEEDRUN*-1.0f )
this->vx = -1.0f*SPEEDRUN;
if ( this->vx <= -SPEEDRUN )
this->vx = -SPEEDRUN;
this->direction = LEFT;
this->action = RUN;
@ -194,7 +194,6 @@ void Player::Run_Right( float dt )
if ( this->vx >= SPEEDRUN )
this->vx = SPEEDRUN;
this->direction = RIGHT;
this->action = RUN;
}
@ -207,11 +206,14 @@ void Player::Jump( float dt )
// check if we are already jumping or not
if (this->action != JUMP && this->action != FALL) // not in a jump or in a fall
{
/*
if ( this->action == WALK )
{
this->vy -= SPEEDJUMPWALK;
}
else if ( this->action == RUN )
else
*/
if ( this->action == RUN )
{
this->vy -= SPEEDJUMPRUN;
}

View File

@ -11,41 +11,29 @@ extern bopti_image_t img_static;
*/
extern bopti_image_t img_circle;
static uint32_t framecounter = 0;
extern Level MyLevel;
#define SPEEDWALK 6.0f
#define SPEEDRUN 12.0f
#define SPEEDSTATIC 0.0f
#define SPEEDJUMPWALK 3.0f
#define SPEEDJUMPRUN 9.0f
#define SPEEDJUMPSTATIC 6.0f
#define SPEEDRUN 9.0f
#define SPEEDJUMP 9.0f
#define MAXFALLSPEED 15.0f
Player::Player( int16_t _x, int16_t _y )
{
this->x = _x;
this->y = _y;
this->currx = _x; // initial position
this->curry = _y;
this->vx = 0.0f;
this->vx = 0.0f; // initial velocity
this->vy = 0.0f;
this->ax = 0.0f;
this->ay = 1.0f;
this->ax = 0.0f; // initial acceleration (ie. gravity chosen at 1 unit - be careful of the sign, y axis oriented to the bottom )
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();
this->action = STATIC;
@ -61,45 +49,21 @@ Player::~Player()
void Player::Update( float dt )
{
float DeltaTime = dt / 100.0f ;
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)
{
this->action = FALL;
}
this->nextx = this->x + this->vx * DeltaTime;
this->nexty = this->y + this->vy * DeltaTime;
this->nextx = this->currx + this->vx * DeltaTime;
this->nexty = this->curry + 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;
ymax = (int) y + height;
}
@ -112,104 +76,44 @@ void Player::Render( void )
framecounter++;
}
azrp_image_p8_effect(xmin, ymin, &img_circle, DIMAGE_NONE);
azrp_image_p8_effect((int) (this->currx*16.0f), (int) (this->curry*16.0f), &img_circle, DIMAGE_NONE);
if (this->action==STATIC) Azur_draw_text( this->xmin+4, this->ymin+4, "S" );
else if (this->action==DRAFT) Azur_draw_text( this->xmin+4, this->ymin+4, "D" );
else if (this->action==WALK) Azur_draw_text( this->xmin+4, this->ymin+4, "W" );
else if (this->action==RUN) Azur_draw_text( this->xmin+4, this->ymin+4, "R" );
else if (this->action==JUMP) Azur_draw_text( this->xmin+4, this->ymin+4, "J" );
else if (this->action==FALL) Azur_draw_text( this->xmin+4, this->ymin+4, "F" );
else Azur_draw_text( this->xmin+4, this->ymin+4, "X" );
if (this->action==STATIC) Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "S" );
else if (this->action==DRAFT) Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "D" );
else if (this->action==WALK) Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "W" );
else if (this->action==RUN) Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "R" );
else if (this->action==JUMP) Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "J" );
else if (this->action==FALL) Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "F" );
else Azur_draw_text( (int) (this->currx*16.0f+4.0f), (int) (this->curry*16.0f+4.0f) , "X" );
}
void Player::Run_Left( float dt )
{
if ( this->action == STATIC )
{
this->vx -= 1.0f;
this->action = RUN;
if ( this->vx <= -SPEEDRUN ) this->vx = -SPEEDRUN;
}
else if ( this->action == JUMP || this->action == FALL )
{
this->vx -= 1.0f;
if ( this->vx <= -SPEEDRUN ) this->vx = -SPEEDRUN;
}
else if ( this->action == RUN || this->action == WALK )
{
this->vx -= 1.0f;
this->action = RUN;
if ( this->vx <= -SPEEDRUN ) this->vx = -SPEEDRUN;
}
void Player::Left( float dt )
{
this->vx += LEFT;
this->direction = LEFT;
this->action = RUN;
}
void Player::Run_Right( float dt )
void Player::Right( float dt )
{
if ( this->action == STATIC )
{
this->vx += 1.0f;
this->action = RUN;
if ( this->vx >= SPEEDRUN ) this->vx = SPEEDRUN;
}
else if ( this->action == JUMP || this->action == FALL )
{
this->vx += 1.0f;
if ( this->vx >= SPEEDRUN ) this->vx = SPEEDRUN;
}
else if ( this->action == RUN || this->action == WALK )
{
this->vx += 1.0f;
this->action = RUN;
if ( this->vx >= SPEEDRUN ) this->vx = SPEEDRUN;
}
this->vx += RIGHT;
this->direction = RIGHT;
this->action = RUN;
}
void Player::Jump( float dt )
{
if ( this->action == STATIC )
{
this->vy = -SPEEDJUMPSTATIC;
}
else if (this->action != JUMP && this->action != FALL) // not in a jump or in a fall
{
this->vy -= SPEEDJUMPRUN;
}
else if ( this->action == FALL) // descending phase (FALL) of a jump, we can start a new small jump
{
this->vy -= SPEEDJUMPSTATIC;
}
else if ( this->action == JUMP) // descending phase (FALL) of a jump, we can start a new small jump
{
this->vy *= 0.9f;
}
this->vy -= SPEEDJUMP;
this->action = JUMP;
}
void Player::No_Order( float dt )
void Player::Nothing( float dt )
{
if (this->action == RUN || this->action == WALK)
{
this->action = DRAFT;
this->vx *= 0.9;
if (ABS(this->vx) <= 0.1 && ABS(this->vy) <= 0.1)
{
this->vx = 0;
this->action = STATIC;
this->direction = STATIC;
}
}
this->vx *= 0.98;
}

View File

@ -35,35 +35,30 @@ class Player
void Update( float dt );
void Render( );
//void Walk_Left( float dt );
//void Walk_Right( float dt );
void Run_Left( float dt );
void Run_Right( float dt );
void No_Order( float dt );
void Left( float dt );
void Right( float dt );
void Nothing( float dt );
void Jump( float dt );
float x, y; // center position of the player
float currx, curry; // 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)
uint16_t xscreen, yscreen;
uint8_t width, height; // width and height - for the hitbox
uint32_t last_tick;
bool playeronground = true;
float currentspeed = 0.0f;
int8_t direction = STATIC;
int8_t action = STATIC;
};
#endif

206
src/vector2D.cpp Normal file
View File

@ -0,0 +1,206 @@
#include "vector2D.h"
#include <num/num.h>
libnum::num32 sqrt_num32(libnum::num32 v)
{
uint32_t t, q, b, r;
r = v.v;
b = 0x40000000;
q = 0;
while( b > 0x40 )
{
t = q + b;
if( r >= t )
{
r -= t;
q = t + b;
}
r <<= 1;
b >>= 1;
}
q >>= 8;
libnum::num32 ret;
ret.v = q;
return ret;
}
Vector2D::Vector2D()
{
this->x = 0.0;
this->y = 0.0;
}
Vector2D::Vector2D( float x, float y )
{
this->x = libnum::num32(x);
this->y = libnum::num32(y);
}
Vector2D::Vector2D( libnum::num32 x, libnum::num32 y )
{
this->x = x;
this->y = y;
}
Vector2D::~Vector2D()
{
this->x = 0.0;
this->y = 0.0;
}
Vector2D Vector2D::Clone( void )
{
Vector2D NewVector( this->x, this->y );
return NewVector;
}
void Vector2D::AddVectors( Vector2D a, Vector2D b )
{
this->x = a.x + b.x;
this->y = a.y + b.y;
}
void Vector2D::Add( Vector2D v, libnum::num32 scale )
{
this->x += v.x * scale;
this->y += v.y * scale;
}
void Vector2D::SubtractVectors( Vector2D a, Vector2D b )
{
this->x = a.x - b.x;
this->y = a.y - b.y;
}
void Vector2D::Subtract( Vector2D v, libnum::num32 scale )
{
this->x -= v.x * scale;
this->y -= v.y * scale;
}
libnum::num32 Vector2D::Length( void )
{
return sqrt_num32( this->x * this->x + this->y * this->y );
}
void Vector2D::Scale( libnum::num32 scale )
{
this->x *= scale;
this->y *= scale;
}
libnum::num32 Vector2D::Dot( Vector2D v )
{
return ( this->x * v.x + this->y * v.y );
}
Vector2D Vector2D::Perp( void )
{
Vector2D temp( -this->y, this->x );
return temp;
}
bool CollisionDroite(Point2D A,Point2D B, Circle C)
{
Vector2D u;
u.x = B.x - A.x;
u.y = B.y - A.y;
Vector2D AC;
AC.x = C.x - A.x;
AC.y = C.y - A.y;
libnum::num numerateur = u.x*AC.y - u.y*AC.x; // norme du vecteur v
if (numerateur <0)
numerateur = -numerateur ; // valeur absolue ; si c'est négatif, on prend l'opposé.
libnum::num denominateur = sqrt_num32(u.x*u.x + u.y*u.y); // norme de u
libnum::num CI = numerateur / denominateur;
if (CI<C.r)
return true;
else
return false;
}
bool CollisionSegment(Point2D A,Point2D B, Circle C)
{
if (CollisionDroite(A,B,C) == false)
return false; // si on ne touche pas la droite, on ne touchera jamais le segment
Vector2D AB,AC,BC;
AB.x = B.x - A.x;
AB.y = B.y - A.y;
AC.x = C.x - A.x;
AC.y = C.y - A.y;
BC.x = C.x - B.x;
BC.y = C.y - B.y;
libnum::num pscal1 = AB.x*AC.x + AB.y*AC.y; // produit scalaire
libnum::num pscal2 = (-AB.x)*BC.x + (-AB.y)*BC.y; // produit scalaire
if (pscal1>=0 && pscal2>=0)
return true; // I entre A et B, ok.
/*
// dernière possibilité, A ou B dans le cercle
if (CollisionPoint2DCercle(A,C))
return true;
if (CollisionPoint2DCercle(B,C))
return true;
*/
return false;
}
bool CollisionBorder(Border B, Circle C)
{
return CollisionSegment( B.A, B.B, C );
}
Vector2D GetNormale(Point2D A,Point2D B,Point2D C)
{
Vector2D AC,u,N;
u.x = B.x - A.x;
u.y = B.y - A.y;
AC.x = C.x - A.x;
AC.y = C.y - A.y;
libnum::num parenthesis = u.x*AC.y-u.y*AC.x; // calcul une fois pour les deux
N.x = -u.y*(parenthesis);
N.y = u.x*(parenthesis);
// normalisons
libnum::num norme = sqrt_num32(N.x*N.x + N.y*N.y);
N.x/=norme;
N.y/=norme;
return N;
}
Point2D ProjectionI(Point2D A,Point2D B,Point2D C)
{
Vector2D u,AC;
u.x = B.x - A.x;
u.y = B.y - A.y;
AC.x = C.x - A.x;
AC.y = C.y - A.y;
libnum::num ti = (u.x*AC.x + u.y*AC.y)/(u.x*u.x + u.y*u.y);
Point2D I;
I.x = A.x + ti*u.x;
I.y = A.y + ti*u.y;
return I;
}
Vector2D ComputeVectorRebound(Vector2D v,Vector2D N)
{
Vector2D v2;
libnum::num pscal = (v.x*N.x + v.y*N.y);
v2.x = v.x -2*pscal*N.x;
v2.y = v.y -2*pscal*N.y;
return v2;
}

117
src/vector2D.h Normal file
View File

@ -0,0 +1,117 @@
#ifndef VECTOR2D_H
#define VECTOR2D_H
#include <num/num.h>
libnum::num32 sqrt_num32(libnum::num32 v);
typedef struct
{
libnum::num x, y;
} Point2D;
typedef struct
{
libnum::num x,y,r;
} Circle;
class Vector2D
{
public:
Vector2D();
Vector2D( float x, float y );
Vector2D( libnum::num32 x, libnum::num32 y );
~Vector2D();
Vector2D Clone( void );
void AddVectors( Vector2D a, Vector2D b );
void Add( Vector2D v, libnum::num32 scale );
void SubtractVectors( Vector2D a, Vector2D b );
void Subtract( Vector2D v, libnum::num32 scale );
libnum::num32 Length( void );
void Scale( libnum::num32 scale );
libnum::num32 Dot( Vector2D v );
Vector2D Perp( void );
inline constexpr Vector2D &operator+=( Vector2D const &other )
{
this->x += other.x;
this->y += other.y;
return *this;
}
inline constexpr Vector2D &operator-=( Vector2D const &other )
{
this->x -= other.x;
this->y -= other.y;
return *this;
}
inline constexpr Vector2D &operator*=( float scale )
{
this->x *= libnum::num32(scale);
this->y *= libnum::num32(scale);
return *this;
}
inline constexpr Vector2D &operator/=( float scale )
{
this->x /= libnum::num32(scale);
this->y /= libnum::num32(scale);
return *this;
}
inline friend Vector2D operator*(float scale, Vector2D const &v) {
Vector2D r;
r.x = v.x * libnum::num32( scale );
r.y = v.y * libnum::num32( scale );
return r;
}
inline friend Vector2D operator*(Vector2D const &v, float scale) {
Vector2D r;
r.x = v.x * libnum::num32( scale );
r.y = v.y * libnum::num32( scale );
return r;
}
inline friend Vector2D operator/(Vector2D const &v, float scale) {
Vector2D r;
r.x = v.x / libnum::num32( scale );
r.y = v.y / libnum::num32( scale );
return r;
}
libnum::num32 x;
libnum::num32 y;
};
typedef struct
{
Point2D A;
Point2D B;
Vector2D N;
} Border;
bool CollisionDroite(Point2D A,Point2D B, Circle C);
bool CollisionSegment(Point2D A,Point2D B,Circle C);
bool CollisionBorder(Border B, Circle C);
Vector2D GetNormale(Point2D A,Point2D B,Point2D C);
Point2D ProjectionI(Point2D A,Point2D B,Point2D C);
Vector2D ComputeVectorRebound(Vector2D v,Vector2D N);
#endif