diff --git a/gamedata/assets/fontmap.png b/gamedata/assets/fontmap.png new file mode 100644 index 0000000..9e8f840 Binary files /dev/null and b/gamedata/assets/fontmap.png differ diff --git a/gamedata/game.py b/gamedata/game.py index d3e6a2b..b085c08 100644 --- a/gamedata/game.py +++ b/gamedata/game.py @@ -30,6 +30,7 @@ class Game(): self.sprite_lib = self.init_assets("gamedata/assets/",load_image) # Dico qui contient chaques images du dossier assets pygame.display.set_icon(self.sprite_lib["icon.png"]) self.sound_lib = self.init_assets("gamedata/sounds/",pygame.mixer.Sound) # Pareil, mais pour les musiques / sons + self.fontmap = self.sprite_lib["fontmap.png"] # Chargement des niveaux def loadlvldata(mapfolder): @@ -282,3 +283,21 @@ class Game(): self.globals["camerah"] = newh self.globals["tempsubsurface"] = pygame.Surface((neww,newh)) + + def getchar(self,char,width=9,height=9): + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@\"#&()*:;?!abcdefghijklmnopqrstuvwxyz" + charsperline = self.fontmap.get_width()//width + result = None + if char in chars: + index = chars.index(char) + line = index//charsperline + column = index%charsperline + result = self.pygame.Surface((width,height),flags=self.pygame.SRCALPHA) + result.blit(self.fontmap,[-width*column,-height*line]) + return result + + def getchars(self,chars): + result = [] + for i in chars: + result.append(self.getchar(i)) + return result diff --git a/gamedata/maps/Level 1/base.png b/gamedata/maps/Level 1/base.png index 5381229..0f3bc19 100644 Binary files a/gamedata/maps/Level 1/base.png and b/gamedata/maps/Level 1/base.png differ diff --git a/gamedata/maps/Level 2/base.png b/gamedata/maps/Level 2/base.png index 5381229..0f3bc19 100644 Binary files a/gamedata/maps/Level 2/base.png and b/gamedata/maps/Level 2/base.png differ diff --git a/gamedata/maps/Level 2/map.json b/gamedata/maps/Level 2/map.json index 74522af..b325631 100644 --- a/gamedata/maps/Level 2/map.json +++ b/gamedata/maps/Level 2/map.json @@ -3357,6 +3357,9 @@ [-1], [-1], [-1], + [6, 6], + [7, 6], + [8, 6], [-1], [-1], [-1], @@ -3388,6 +3391,92 @@ [-1], [-1], [-1], + [9, 8], + [-1], + [9, 8], + [-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], + [6, 7], + [7, 7], + [8, 7], + [-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], @@ -3420,6 +3509,13 @@ [-1], [-1], [-1], + [10, 6], + [9, 6], + [10, 6], + [9, 6], + [10, 6], + [9, 6], + [10, 6], [-1], [-1], [-1], @@ -3430,6 +3526,22 @@ [-1], [-1], [-1], + [14, 0], + [15, 0], + [14, 0], + [15, 0], + [14, 0], + [15, 0], + [14, 0], + [15, 0], + [9, 8], + [6, 8], + [7, 8], + [8, 8], + [9, 8], + [15, 0], + [14, 0], + [15, 0], [-1], [-1], [-1], @@ -3438,6 +3550,9 @@ [-1], [-1], [-1], + [15, 0], + [14, 0], + [15, 0], [-1], [-1], [-1], @@ -3464,33 +3579,7 @@ [-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], + [9, 8], [-1], [-1], [-1], @@ -3509,102 +3598,13 @@ [-1], [-1], [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [14, 0], - [15, 0], - [14, 0], - [15, 0], - [14, 0], - [15, 0], - [14, 0], - [15, 0], - [-1], - [-1], - [-1], - [-1], - [-1], - [15, 0], - [14, 0], - [15, 0], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [-1], - [15, 0], - [14, 0], - [15, 0], - [-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], + [10, 7], + [9, 7], + [10, 7], + [9, 7], + [10, 7], + [9, 7], + [10, 7], [-1], [-1], [-1], @@ -4928,12 +4928,12 @@ "name": "WaterChange", "id": 40, "_eid": "48957583", - "x": 208, - "y": 208, + "x": 64, + "y": 176, "originX": 0, "originY": 0, "nodes": [ - {"x": 240, "y": 240} + {"x": 96, "y": 240} ], "values": {"Speed": 1} } diff --git a/gamedata/objects/ingame/player.py b/gamedata/objects/ingame/player.py index c4cfc56..ba7040c 100644 --- a/gamedata/objects/ingame/player.py +++ b/gamedata/objects/ingame/player.py @@ -15,6 +15,7 @@ class Player(Movable): self.spritefalling = game.sprite_lib["player/falling.png"] # Descending self.spritehurt = game.sprite_lib["player/hurt.png"] # Being hurted self.spritelanding = game.sprite_lib["player/landing.png"] + self.testsprites = self.game.getchars("Test") self.landingtimer = 0 self.maxlandtime = 0.15 self.spriteindex = 0 @@ -276,3 +277,7 @@ class Player(Movable): flipy = self.fastfall<0 sprite = self.game.pygame.transform.flip(self.sprite,self.flipx,flipy) self.game.window.blit(sprite,[self.rect[0]-self.game.globals["camerax"]-self.spriteoffset,self.rect[1]-self.game.globals["cameray"]]) + + for i,spr in enumerate(self.testsprites): + if spr: + self.game.window.blit(spr,[self.rect[0]+i*9-self.game.globals["camerax"]-self.spriteoffset,self.rect[1]-self.game.globals["cameray"]])