diff --git a/gamedata/assets/flags/base.png b/gamedata/assets/flags/base.png new file mode 100644 index 0000000..205668c Binary files /dev/null and b/gamedata/assets/flags/base.png differ diff --git a/gamedata/assets/flags/blue/0.png b/gamedata/assets/flags/blue/0.png new file mode 100644 index 0000000..2806973 Binary files /dev/null and b/gamedata/assets/flags/blue/0.png differ diff --git a/gamedata/assets/flags/blue/1.png b/gamedata/assets/flags/blue/1.png new file mode 100644 index 0000000..1b451f6 Binary files /dev/null and b/gamedata/assets/flags/blue/1.png differ diff --git a/gamedata/assets/flags/blue/2.png b/gamedata/assets/flags/blue/2.png new file mode 100644 index 0000000..e892ee8 Binary files /dev/null and b/gamedata/assets/flags/blue/2.png differ diff --git a/gamedata/assets/flags/blue/3.png b/gamedata/assets/flags/blue/3.png new file mode 100644 index 0000000..9422927 Binary files /dev/null and b/gamedata/assets/flags/blue/3.png differ diff --git a/gamedata/assets/flags/blue/4.png b/gamedata/assets/flags/blue/4.png new file mode 100644 index 0000000..1e337d4 Binary files /dev/null and b/gamedata/assets/flags/blue/4.png differ diff --git a/gamedata/assets/flags/green/0.png b/gamedata/assets/flags/green/0.png new file mode 100644 index 0000000..a91ab1b Binary files /dev/null and b/gamedata/assets/flags/green/0.png differ diff --git a/gamedata/assets/flags/green/1.png b/gamedata/assets/flags/green/1.png new file mode 100644 index 0000000..09215f7 Binary files /dev/null and b/gamedata/assets/flags/green/1.png differ diff --git a/gamedata/assets/flags/green/2.png b/gamedata/assets/flags/green/2.png new file mode 100644 index 0000000..6f901b8 Binary files /dev/null and b/gamedata/assets/flags/green/2.png differ diff --git a/gamedata/assets/flags/green/3.png b/gamedata/assets/flags/green/3.png new file mode 100644 index 0000000..e8ea008 Binary files /dev/null and b/gamedata/assets/flags/green/3.png differ diff --git a/gamedata/assets/flags/green/4.png b/gamedata/assets/flags/green/4.png new file mode 100644 index 0000000..0e54ba3 Binary files /dev/null and b/gamedata/assets/flags/green/4.png differ diff --git a/gamedata/game.py b/gamedata/game.py index 35f7824..6773dc0 100644 --- a/gamedata/game.py +++ b/gamedata/game.py @@ -89,10 +89,12 @@ class Game(): self.globals = {} # Un dico pour ranger toute les valeurs globales, pour communiquer entre objets par exemples self.globals["camerax"] = 0 self.globals["cameray"] = 0 - self.globals["scamerax"] = 3 + self.globals["scamerax"] = 0 self.globals["scameray"] = 0 self.globals["players"] = [] self.globals["hitpose"] = False + self.globals["finishedlevels"] = [] # Levels where the player went to the end + self.globals["completedlevels"] = [] # Levels where the player kicked all non-respawnable ennemies self.scaleCamera() settings = {"sfx":1,"bgm":1} @@ -104,7 +106,7 @@ class Game(): self.pasttime = time.time() # Je charge la scene de base - scenes.ingame(self) + scenes.overworld(self) def set_camera(self,posx,posy): self.globals["camerax"], self.globals["cameray"] = posx,posy diff --git a/gamedata/maps/Overworld/background0.png b/gamedata/maps/Overworld/background0.png new file mode 100644 index 0000000..9d30411 Binary files /dev/null and b/gamedata/maps/Overworld/background0.png differ diff --git a/gamedata/maps/Overworld/filler.png b/gamedata/maps/Overworld/filler.png new file mode 100644 index 0000000..5dedf3a Binary files /dev/null and b/gamedata/maps/Overworld/filler.png differ diff --git a/gamedata/maps/Overworld/map.json b/gamedata/maps/Overworld/map.json new file mode 100644 index 0000000..aa43faf --- /dev/null +++ b/gamedata/maps/Overworld/map.json @@ -0,0 +1,1591 @@ +{ + "ogmoVersion": "3.4.0", + "width": 768, + "height": 240, + "offsetX": 0, + "offsetY": 0, + "layers": [ + { + "name": "1Platforms", + "_eid": "26655533", + "offsetX": 0, + "offsetY": 0, + "gridCellWidth": 16, + "gridCellHeight": 16, + "gridCellsX": 48, + "gridCellsY": 15, + "tileset": "overworldtiles.png", + "dataCoords2D": [ + [ + [3, 7], + [4, 7], + [5, 7], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [6, 3], + [5, 3], + [3, 5], + [4, 5], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 4], + [4, 5], + [4, 5], + [5, 5], + [5, 3], + [5, 3], + [3, 7], + [4, 7], + [5, 7], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [5, 3], + [8, 3], + [9, 3], + [10, 3], + [11, 3], + [12, 3], + [13, 3], + [14, 3], + [3, 4], + [4, 4], + [4, 4], + [4, 4], + [4, 3], + [0, 3], + [1, 7], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 6], + [14, 0], + [15, 0], + [16, 0], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [0, 6], + [2, 5], + [4, 5], + [3, 2], + [17, 2], + [18, 2], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [23, 2], + [24, 2], + [25, 2], + [5, 3], + [6, 3] + ], + [ + [5, 3], + [8, 4], + [9, 4], + [10, 4], + [11, 4], + [12, 4], + [13, 4], + [14, 4], + [4, 3], + [4, 5], + [4, 5], + [0, 3], + [1, 3], + [1, 7], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [14, 0], + [15, 0], + [18, 1], + [15, 1], + [16, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [0, 6], + [1, 5], + [2, 5], + [4, 5], + [15, 3], + [16, 3], + [17, 3], + [18, 3], + [19, 3], + [20, 3], + [21, 3], + [22, 3], + [23, 3], + [24, 3], + [25, 3], + [26, 3], + [5, 3] + ], + [ + [5, 3], + [8, 5], + [9, 5], + [10, 5], + [11, 5], + [12, 5], + [13, 5], + [14, 5], + [4, 5], + [4, 5], + [0, 3], + [1, 7], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [6, 4], + [7, 4], + [1, 1], + [1, 1], + [14, 1], + [15, 1], + [17, 0], + [15, 2], + [16, 2], + [1, 1], + [1, 1], + [0, 6], + [1, 5], + [2, 5], + [4, 5], + [4, 5], + [4, 5], + [15, 4], + [16, 4], + [17, 4], + [18, 4], + [19, 4], + [20, 4], + [21, 4], + [22, 4], + [23, 4], + [24, 4], + [25, 4], + [26, 4], + [5, 3] + ], + [ + [5, 3], + [8, 6], + [9, 6], + [10, 6], + [11, 6], + [12, 6], + [13, 6], + [14, 6], + [4, 5], + [4, 5], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [6, 5], + [7, 5], + [1, 1], + [1, 1], + [14, 2], + [15, 2], + [16, 2], + [0, 6], + [1, 5], + [1, 5], + [1, 5], + [2, 5], + [4, 5], + [4, 5], + [4, 5], + [3, 2], + [4, 6], + [15, 5], + [16, 5], + [17, 5], + [18, 5], + [19, 5], + [20, 5], + [21, 5], + [22, 5], + [23, 5], + [24, 5], + [25, 5], + [26, 5], + [5, 3] + ], + [ + [7, 3], + [8, 7], + [9, 7], + [10, 7], + [11, 7], + [12, 7], + [13, 7], + [14, 7], + [4, 5], + [4, 5], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 6], + [1, 1], + [3, 0], + [1, 2], + [8, 0], + [9, 0], + [9, 0], + [9, 0], + [9, 0], + [10, 0], + [4, 5], + [4, 5], + [4, 5], + [4, 5], + [3, 2], + [4, 6], + [4, 6], + [5, 6], + [22, 2], + [15, 6], + [16, 6], + [17, 6], + [18, 6], + [19, 6], + [20, 6], + [21, 6], + [22, 6], + [23, 6], + [24, 6], + [25, 6], + [26, 6], + [22, 2] + ], + [ + [22, 2], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [3, 5], + [4, 5], + [22, 2], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [3, 0], + [1, 2], + [2, 2], + [5, 3], + [8, 1], + [9, 1], + [9, 1], + [9, 1], + [9, 1], + [10, 1], + [4, 5], + [4, 5], + [4, 5], + [4, 5], + [3, 3], + [4, 4], + [5, 4], + [5, 3], + [5, 3], + [6, 3], + [16, 7], + [17, 7], + [18, 7], + [19, 7], + [20, 7], + [21, 7], + [22, 7], + [23, 7], + [24, 7], + [25, 7], + [26, 7], + [5, 3] + ], + [ + [5, 3], + [5, 3], + [6, 3], + [5, 3], + [5, 3], + [22, 2], + [5, 3], + [3, 5], + [4, 5], + [4, 5], + [0, 5], + [8, 0], + [9, 0], + [9, 0], + [9, 0], + [10, 0], + [2, 2], + [5, 3], + [5, 3], + [5, 3], + [8, 2], + [9, 2], + [9, 2], + [9, 2], + [9, 2], + [10, 2], + [1, 3], + [1, 3], + [2, 3], + [4, 5], + [4, 5], + [4, 5], + [3, 3], + [4, 4], + [5, 4], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [22, 2], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [6, 3], + [5, 3], + [5, 3], + [3, 5], + [4, 5], + [4, 5], + [4, 5], + [8, 1], + [9, 1], + [9, 1], + [9, 1], + [10, 1], + [5, 3], + [5, 3], + [0, 0], + [1, 0], + [4, 1], + [1, 1], + [6, 4], + [7, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [0, 7], + [1, 3], + [1, 3], + [1, 3], + [2, 3], + [4, 5], + [3, 3], + [5, 4], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [6, 3], + [5, 3], + [5, 3], + [7, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [7, 3], + [5, 3], + [5, 3], + [3, 6], + [4, 2], + [4, 5], + [4, 5], + [8, 2], + [9, 2], + [9, 2], + [9, 2], + [10, 2], + [1, 0], + [1, 0], + [4, 1], + [1, 1], + [1, 1], + [2, 7], + [6, 5], + [7, 5], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [0, 7], + [2, 3], + [4, 5], + [5, 5], + [5, 3], + [5, 3], + [7, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [5, 3], + [11, 0], + [12, 0], + [13, 0], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [3, 5], + [4, 5], + [4, 5], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [14, 0], + [15, 0], + [16, 0], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 7], + [1, 1], + [1, 1], + [1, 1], + [2, 4], + [4, 5], + [5, 5], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [11, 0], + [12, 0], + [13, 0] + ], + [ + [5, 3], + [11, 1], + [12, 1], + [13, 1], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [3, 6], + [4, 2], + [4, 5], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [14, 1], + [15, 1], + [16, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 4], + [4, 5], + [3, 3], + [5, 4], + [5, 3], + [5, 3], + [5, 3], + [0, 0], + [1, 0], + [1, 0], + [2, 0], + [5, 3], + [11, 1], + [12, 1], + [13, 1] + ], + [ + [5, 3], + [11, 2], + [12, 2], + [13, 2], + [5, 3], + [6, 3], + [5, 3], + [6, 6], + [7, 6], + [3, 6], + [4, 2], + [0, 5], + [1, 6], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [14, 2], + [15, 2], + [16, 2], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [0, 7], + [2, 3], + [4, 5], + [5, 5], + [5, 3], + [5, 3], + [5, 3], + [0, 1], + [1, 1], + [1, 1], + [3, 1], + [2, 0], + [11, 2], + [12, 2], + [13, 2] + ], + [ + [5, 3], + [6, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [6, 7], + [7, 7], + [5, 3], + [3, 6], + [4, 2], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [2, 6], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 4], + [4, 5], + [3, 3], + [5, 4], + [5, 3], + [7, 3], + [0, 2], + [4, 0], + [1, 1], + [1, 1], + [2, 1], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [7, 3], + [5, 3], + [5, 3], + [5, 3], + [5, 3], + [7, 3], + [5, 3], + [3, 5], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 4], + [4, 5], + [4, 5], + [5, 5], + [5, 3], + [5, 3], + [5, 3], + [0, 2], + [1, 2], + [1, 2], + [2, 2], + [5, 3], + [5, 3], + [5, 3] + ] + ], + "exportMode": 1, + "arrayMode": 1 + }, + { + "name": "2Background", + "_eid": "25867920", + "offsetX": 0, + "offsetY": 0, + "gridCellWidth": 16, + "gridCellHeight": 16, + "gridCellsX": 48, + "gridCellsY": 15, + "tileset": "overworldtiles.png", + "dataCoords2D": [ + [ + [5, 3], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1] + ], + [ + [-1], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [6, 3], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [6, 3], + [5, 3], + [-1], + [-1] + ], + [ + [-1], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [3, 4], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [4, 5], + [5, 5], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [-1] + ], + [ + [-1], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [3, 5], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [-1], + [-1], + [1, 1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [3, 2], + [5, 6], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [-1] + ], + [ + [-1], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [3, 5], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [-1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 6], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [-1] + ], + [ + [-1], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [3, 5], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [-1], + [-1], + [-1], + [4, 0], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [2, 4], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [5, 3] + ], + [ + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [4, 5], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [0, 1], + [-1], + [-1], + [-1], + [-1], + [2, 4], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [-1] + ], + [ + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 6], + [1, 1], + [1, 1], + [1, 1], + [3, 0], + [-1], + [-1], + [-1], + [-1], + [0, 1], + [1, 1], + [1, 1], + [1, 1], + [1, 1], + [0, 7], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1] + ], + [ + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [0, 4], + [-1], + [-1], + [-1], + [2, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1] + ], + [ + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [0, 4], + [1, 1], + [1, 1], + [1, 1], + [3, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1] + ], + [ + [-1], + [5, 3], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [6, 3], + [5, 3], + [6, 3] + ], + [ + [-1], + [5, 3], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [-1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [-1], + [5, 3], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [1, 1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [5, 3] + ], + [ + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [5, 3], + [5, 3], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [1, 1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1] + ], + [ + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1], + [-1] + ] + ], + "exportMode": 1, + "arrayMode": 1 + }, + { + "name": "Solids", + "_eid": "17026890", + "offsetX": 0, + "offsetY": 0, + "gridCellWidth": 16, + "gridCellHeight": 16, + "gridCellsX": 48, + "gridCellsY": 15, + "entities": [] + }, + { + "name": "Spawns", + "_eid": "25815759", + "offsetX": 0, + "offsetY": 0, + "gridCellWidth": 16, + "gridCellHeight": 16, + "gridCellsX": 48, + "gridCellsY": 15, + "entities": [] + }, + { + "name": "Ennemies", + "_eid": "09737179", + "offsetX": 0, + "offsetY": 0, + "gridCellWidth": 16, + "gridCellHeight": 16, + "gridCellsX": 48, + "gridCellsY": 15, + "entities": [ + { + "name": "Levels", + "id": 0, + "_eid": "61074981", + "x": 80, + "y": 176, + "originX": 0, + "originY": 0, + "nodes": [ + {"x": 64, "y": 144}, + {"x": 144, "y": 128}, + {"x": 272, "y": 128}, + {"x": 304, "y": 96}, + {"x": 512, "y": 96}, + {"x": 640, "y": 144} + ], + "values": {"0": "Beginning", "1": "The Docks"} + } + ] + } + ] +} \ No newline at end of file diff --git a/gamedata/maps/Overworld/overworldtiles.png b/gamedata/maps/Overworld/overworldtiles.png new file mode 100644 index 0000000..4d3ccf9 Binary files /dev/null and b/gamedata/maps/Overworld/overworldtiles.png differ diff --git a/gamedata/objects/ingame/tileset.py b/gamedata/objects/ingame/tileset.py index 184330f..f53a158 100644 --- a/gamedata/objects/ingame/tileset.py +++ b/gamedata/objects/ingame/tileset.py @@ -4,6 +4,7 @@ from gamedata.objects.ingame.ennemies.crate import Crate from gamedata.objects.ingame.ennemies.balloon import Balloon from gamedata.objects.ingame.ennemies.spring import Spring from gamedata.objects.ingame.ennemies.waterchange import WaterChange +from gamedata.objects.levels import Levels class TilesetRenderer(BaseObject): @@ -69,7 +70,7 @@ class TilesetRenderer(BaseObject): self.layers = [] self.spawns = [] spawnlists = {"Spawns":self.spawns} - ennemies = {"Robot":Robot,"Crate":Crate,"Balloon":Balloon,"Spring":Spring,"WaterChange":WaterChange} + ennemies = {"Robot":Robot,"Crate":Crate,"Balloon":Balloon,"Spring":Spring,"WaterChange":WaterChange,"Levels":Levels} self.queue = [] # For spawning ennemies after beeing initialized if "layers" in json.keys() and type(json["layers"]).__name__=="list": solidlayer = False diff --git a/gamedata/objects/levels.py b/gamedata/objects/levels.py new file mode 100644 index 0000000..9de3bbc --- /dev/null +++ b/gamedata/objects/levels.py @@ -0,0 +1,96 @@ +from gamedata.objects.base import BaseObject + +class Levels(BaseObject): + + def __init__(self,x,y,game,nodes,customvalues): + + super().__init__(0,0,game) + self.nodes = nodes + self.customvalues = customvalues + + self.blueflags = self.game.getSpriteDir("flags/blue/") + self.greenflags= self.game.getSpriteDir("flags/green/") + self.flagbase = self.game.sprite_lib["flags/base.png"] + + self.playerwalking = self.game.getSpriteDir("player/walking/") + self.playerstill = self.game.sprite_lib["player/still.png"] + + self.flagsindex = [] + self.names = [] + self.textnumbers = [] + for i,v in enumerate(self.nodes): + v["x"]+=8 # Center on tiles + v["y"]+=8 + self.flagsindex.append(self.game.lib.randint(1,3)) + + # Get sprites for "Level N" + sprites = self.game.getchars("Level "+str(i+1)) + text = self.game.pygame.Surface((len(sprites)*9,9),flags=self.game.pygame.SRCALPHA) + for j,s in enumerate(sprites): + if s: + text.blit(s,[j*9,0]) + self.textnumbers.append(text) + + # Get sprites for the level's name + if str(i) in customvalues.keys(): + sprites = self.game.getchars(customvalues[str(i)]) + text = self.game.pygame.Surface((len(sprites)*9,9),flags=self.game.pygame.SRCALPHA) + for i,v in enumerate(sprites): + if v: + text.blit(v,[i*9,0]) + self.names.append(text) + else: + self.names.append(None) + + self.animspeed = 7 + self.cursor = 0 # Which level is selected + + self.tileset = self.game.gameloop.findname("TilesetRenderer")[0] + self.maxwidth = self.tileset.layers[0]["surface"].get_width() + + def step(self): + for i in range(len(self.flagsindex)): + self.flagsindex[i]+=self.animspeed*self.game.dt + + if self.game.inputs["keys"]["right"]["timer"]==1: + self.cursor+=1 + if self.game.inputs["keys"]["left"]["timer"]==1: + self.cursor-=1 + if self.game.inputs["keys"]["up"]["timer"]==1: + # Launch the level + self.game.scenes.ingame(self.game,level="Level "+str(self.cursor+1)) + self.cursor = min(self.cursor,len(self.nodes)-1) + self.cursor = max(0,self.cursor) + + self.playerx = self.nodes[self.cursor]["x"] + + self.game.globals["camerax"] = self.playerx-self.game.globals["cameraw"]/2 + self.game.globals["camerax"] = max(0,self.game.globals["camerax"]) + self.game.globals["camerax"] = min(self.maxwidth-self.game.globals["cameraw"],self.game.globals["camerax"]) + + def draw(self): + for i,v in enumerate(self.nodes): # Draw flags + sprites = self.blueflags + sprite = sprites[int(self.flagsindex[i])%len(sprites)] + x = v["x"]-sprite.get_width()/2-self.game.globals["camerax"]+8 + y = v["y"]-sprite.get_height()-self.game.globals["cameray"] + self.game.window.blit(self.flagbase,[v["x"]-self.game.globals["camerax"]-8,v["y"]-self.game.globals["cameray"]-2]) + self.game.window.blit(sprite,[x,y]) + + # Draw player + sprite = self.playerstill + x = self.nodes[self.cursor]["x"]-self.game.globals["camerax"]-sprite.get_width()/2 + y = self.nodes[self.cursor]["y"]-self.game.globals["cameray"]-sprite.get_height()/2 + self.game.window.blit(sprite,[x,y]) + + # Draw level's number + sprite = self.textnumbers[self.cursor] + x = self.nodes[self.cursor]["x"]-self.game.globals["camerax"]-sprite.get_width()/2 + y = self.nodes[self.cursor]["y"]-self.game.globals["cameray"]-sprite.get_height()/2-50 + self.game.window.blit(sprite,[x,y]) + # Draw the level's name + if self.names[self.cursor]: + sprite = self.names[self.cursor] + x = self.nodes[self.cursor]["x"]-self.game.globals["camerax"]-sprite.get_width()/2 + y = self.nodes[self.cursor]["y"]-self.game.globals["cameray"]-sprite.get_height()/2-40 + self.game.window.blit(sprite,[x,y]) diff --git a/gamedata/scenes.py b/gamedata/scenes.py index e081005..b6726ce 100644 --- a/gamedata/scenes.py +++ b/gamedata/scenes.py @@ -28,6 +28,12 @@ def ingame(game,level="Level 2"): p1 = Player(game) game.gameloop.summon(p1) +def overworld(game): + game.scaleCamera(416,234) + game.gameloop.reinit() + tileset = TilesetRenderer(0,0,game,"Overworld") + game.gameloop.summon(tileset) + def options(game): game.gameloop.reinit() game.globals["camerax"] = 0