Added Squids
This commit is contained in:
parent
572002db32
commit
c76ea8fe55
7
CREDITS.md
Normal file
7
CREDITS.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Credits
|
||||||
|
|
||||||
|
## Musics
|
||||||
|
|
||||||
|
- Overworld : Kevin MacLeod - Itty Bitty 8 Bit
|
||||||
|
- Level 1 : Jeremy Blake - Powerup
|
||||||
|
|
BIN
gamedata/assets/squid/0.png
Normal file
BIN
gamedata/assets/squid/0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 757 B |
BIN
gamedata/assets/squid/1.png
Normal file
BIN
gamedata/assets/squid/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 761 B |
BIN
gamedata/assets/squid/2.png
Normal file
BIN
gamedata/assets/squid/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 721 B |
BIN
gamedata/assets/squid/death.png
Normal file
BIN
gamedata/assets/squid/death.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 719 B |
@ -42,6 +42,7 @@ class Game():
|
|||||||
mapdico["backgrounds"] = []
|
mapdico["backgrounds"] = []
|
||||||
mapdico["data"] = None
|
mapdico["data"] = None
|
||||||
mapdico["filler"] = None
|
mapdico["filler"] = None
|
||||||
|
mapdico["bgm"] = None
|
||||||
mapdico["tilesets"] = {}
|
mapdico["tilesets"] = {}
|
||||||
scanner = os.scandir(path=mapfolder)
|
scanner = os.scandir(path=mapfolder)
|
||||||
for i in scanner: # Je check tout les fichiers du dossier
|
for i in scanner: # Je check tout les fichiers du dossier
|
||||||
@ -56,6 +57,8 @@ class Game():
|
|||||||
mapdico["filler"] = pygame.image.load(i.path).convert_alpha()
|
mapdico["filler"] = pygame.image.load(i.path).convert_alpha()
|
||||||
else:
|
else:
|
||||||
mapdico["tilesets"][i.name] = pygame.image.load(i.path).convert_alpha()
|
mapdico["tilesets"][i.name] = pygame.image.load(i.path).convert_alpha()
|
||||||
|
if name=="bgm.mp3":
|
||||||
|
mapdico["bgm"] = pygame.mixer.Sound(i.path)
|
||||||
except:
|
except:
|
||||||
self.log("Erreur",mapfolder,name,"Fichier invalide")
|
self.log("Erreur",mapfolder,name,"Fichier invalide")
|
||||||
if name=="map.json":
|
if name=="map.json":
|
||||||
@ -99,7 +102,7 @@ class Game():
|
|||||||
self.globals["allunlocked"] = True
|
self.globals["allunlocked"] = True
|
||||||
self.scaleCamera()
|
self.scaleCamera()
|
||||||
|
|
||||||
settings = {"sfx":1,"bgm":1}
|
settings = {"sfx":1,"bgm":0.2}
|
||||||
self.globals["bgmvolume"] = settings["bgm"]
|
self.globals["bgmvolume"] = settings["bgm"]
|
||||||
self.globals["sfxvolume"] = settings["sfx"]
|
self.globals["sfxvolume"] = settings["sfx"]
|
||||||
|
|
||||||
|
BIN
gamedata/maps/Level 1/bgm.mp3
Normal file
BIN
gamedata/maps/Level 1/bgm.mp3
Normal file
Binary file not shown.
BIN
gamedata/maps/Level 2/bgm.mp3
Normal file
BIN
gamedata/maps/Level 2/bgm.mp3
Normal file
Binary file not shown.
@ -8577,7 +8577,33 @@
|
|||||||
},
|
},
|
||||||
{"name": "End", "id": 19, "_eid": "65940624", "x": 2800, "y": 128, "originX": 0, "originY": 0},
|
{"name": "End", "id": 19, "_eid": "65940624", "x": 2800, "y": 128, "originX": 0, "originY": 0},
|
||||||
{"name": "TrashBag", "id": 20, "_eid": "74601465", "x": 1664, "y": 96, "originX": 0, "originY": 0},
|
{"name": "TrashBag", "id": 20, "_eid": "74601465", "x": 1664, "y": 96, "originX": 0, "originY": 0},
|
||||||
{"name": "TrashBag", "id": 21, "_eid": "74601465", "x": 2752, "y": 160, "originX": 0, "originY": 0}
|
{"name": "TrashBag", "id": 21, "_eid": "74601465", "x": 2752, "y": 160, "originX": 0, "originY": 0},
|
||||||
|
{
|
||||||
|
"name": "Squid",
|
||||||
|
"id": 22,
|
||||||
|
"_eid": "82317402",
|
||||||
|
"x": 1408,
|
||||||
|
"y": 112,
|
||||||
|
"originX": 0,
|
||||||
|
"originY": 0,
|
||||||
|
"nodes": [
|
||||||
|
{"x": 1408, "y": 80},
|
||||||
|
{"x": 1408, "y": 144}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Squid",
|
||||||
|
"id": 23,
|
||||||
|
"_eid": "82317402",
|
||||||
|
"x": 2032,
|
||||||
|
"y": 240,
|
||||||
|
"originX": 0,
|
||||||
|
"originY": 0,
|
||||||
|
"nodes": [
|
||||||
|
{"x": 2032, "y": 192},
|
||||||
|
{"x": 2032, "y": 288}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -40,6 +40,8 @@ class EndFlag(Ennemy):
|
|||||||
if self.player.rect.colliderect(self.rect):
|
if self.player.rect.colliderect(self.rect):
|
||||||
self.sprites = self.greenflags
|
self.sprites = self.greenflags
|
||||||
self.player.canmove = False
|
self.player.canmove = False
|
||||||
|
if self.player.tileset.bgm:
|
||||||
|
self.player.tileset.bgm.stop()
|
||||||
if not self.ended:
|
if not self.ended:
|
||||||
self.ended = True
|
self.ended = True
|
||||||
nb = 30
|
nb = 30
|
||||||
|
66
gamedata/objects/ingame/ennemies/squid.py
Normal file
66
gamedata/objects/ingame/ennemies/squid.py
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
from gamedata.objects.ingame.ennemies.ennemy import Ennemy
|
||||||
|
|
||||||
|
class Squid(Ennemy):
|
||||||
|
|
||||||
|
def __init__(self,*args):
|
||||||
|
|
||||||
|
super().__init__(*args)
|
||||||
|
|
||||||
|
self.sprites = self.game.getSpriteDir("squid/")
|
||||||
|
self.sprite = self.sprites[0]
|
||||||
|
self.deadsprite = self.game.sprite_lib["squid/death.png"]
|
||||||
|
|
||||||
|
self.rect[2],self.rect[3] = self.deadsprite.get_size()
|
||||||
|
|
||||||
|
self.speed = 40
|
||||||
|
self.spriteindex = 0
|
||||||
|
|
||||||
|
self.respawn = False
|
||||||
|
|
||||||
|
self.fallingway = 1 # Horizontal flip
|
||||||
|
|
||||||
|
# Offset it correctly
|
||||||
|
self.rect[1] += 8-self.rect[3]/2
|
||||||
|
|
||||||
|
# Movement boundaries
|
||||||
|
if self.nodes:
|
||||||
|
self.endpoints = [x["y"] for x in self.nodes[:2]] # Get only the two first y positions
|
||||||
|
self.endpoints.sort()
|
||||||
|
else:
|
||||||
|
self.endpoints = None
|
||||||
|
|
||||||
|
self.game.globals["totaltrashes"]+=1
|
||||||
|
|
||||||
|
def deadtrigger(self):
|
||||||
|
self.game.globals["trashes"]+=1
|
||||||
|
|
||||||
|
def step(self):
|
||||||
|
|
||||||
|
if not self.dead:
|
||||||
|
|
||||||
|
# Flipping horizontally
|
||||||
|
if self.endpoints:
|
||||||
|
if self.rect.center[1]<self.endpoints[0]:
|
||||||
|
self.fallingway = 1
|
||||||
|
if self.rect.center[1]>self.endpoints[1]:
|
||||||
|
self.fallingway = -1
|
||||||
|
|
||||||
|
speedmult = [0.5,0,2][int(self.spriteindex)%len(self.sprites)]
|
||||||
|
|
||||||
|
if self.fallingway<0:
|
||||||
|
self.verspd = self.speed*self.game.dt*speedmult*-1
|
||||||
|
else:
|
||||||
|
self.verspd += self.speed*self.game.dt/10
|
||||||
|
|
||||||
|
self.spriteindex += self.speed*self.game.dt*0.15
|
||||||
|
|
||||||
|
super().step() # Actually move
|
||||||
|
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
|
||||||
|
if not self.dead:
|
||||||
|
self.sprite = self.sprites[int(self.spriteindex)%len(self.sprites)]
|
||||||
|
if self.fallingway>0:
|
||||||
|
self.sprite = self.sprites[1]
|
||||||
|
self.game.window.blit(self.sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]])
|
@ -319,6 +319,9 @@ class Player(Movable):
|
|||||||
|
|
||||||
self.game.addParticle([self.spritehurt],self.rect.center[0],self.rect.center[1],fps=0.6,vely=-1.5,modvely=0.15) # Die sprite
|
self.game.addParticle([self.spritehurt],self.rect.center[0],self.rect.center[1],fps=0.6,vely=-1.5,modvely=0.15) # Die sprite
|
||||||
|
|
||||||
|
if self.tileset.bgm:
|
||||||
|
self.tileset.bgm.stop()
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
if not self.dead:
|
if not self.dead:
|
||||||
flipy = (self.gravityway<0 and not self.leaptimer<0)
|
flipy = (self.gravityway<0 and not self.leaptimer<0)
|
||||||
|
@ -5,6 +5,7 @@ from gamedata.objects.ingame.ennemies.balloon import Balloon
|
|||||||
from gamedata.objects.ingame.ennemies.spring import Spring
|
from gamedata.objects.ingame.ennemies.spring import Spring
|
||||||
from gamedata.objects.ingame.ennemies.waterchange import WaterChange
|
from gamedata.objects.ingame.ennemies.waterchange import WaterChange
|
||||||
from gamedata.objects.ingame.ennemies.trashbag import TrashBag
|
from gamedata.objects.ingame.ennemies.trashbag import TrashBag
|
||||||
|
from gamedata.objects.ingame.ennemies.squid import Squid
|
||||||
from gamedata.objects.ingame.endflag import EndFlag
|
from gamedata.objects.ingame.endflag import EndFlag
|
||||||
from gamedata.objects.levels import Levels
|
from gamedata.objects.levels import Levels
|
||||||
from gamedata.objects.ripple import Ripple
|
from gamedata.objects.ripple import Ripple
|
||||||
@ -78,8 +79,12 @@ class TilesetRenderer(BaseObject):
|
|||||||
self.spikes = []
|
self.spikes = []
|
||||||
self.layers = []
|
self.layers = []
|
||||||
self.spawns = []
|
self.spawns = []
|
||||||
|
self.bgm = level["bgm"]
|
||||||
|
if self.bgm:
|
||||||
|
self.bgm.set_volume(self.game.globals["bgmvolume"])
|
||||||
|
self.bgm.play(-1)
|
||||||
spawnlists = {"Spawns":self.spawns}
|
spawnlists = {"Spawns":self.spawns}
|
||||||
ennemies = {"Robot":Robot,"Crate":Crate,"Balloon":Balloon,"Spring":Spring,"WaterChange":WaterChange,"Levels":Levels,"End":EndFlag,"TrashBag":TrashBag,"Ripple":Ripple}
|
ennemies = {"Robot":Robot,"Crate":Crate,"Balloon":Balloon,"Spring":Spring,"WaterChange":WaterChange,"Levels":Levels,"End":EndFlag,"TrashBag":TrashBag,"Ripple":Ripple,"Squid":Squid}
|
||||||
self.queue = [] # For spawning ennemies after beeing initialized
|
self.queue = [] # For spawning ennemies after beeing initialized
|
||||||
if "layers" in json.keys() and type(json["layers"]).__name__=="list":
|
if "layers" in json.keys() and type(json["layers"]).__name__=="list":
|
||||||
solidlayer = False
|
solidlayer = False
|
||||||
|
@ -9,6 +9,9 @@ class Levels(BaseObject):
|
|||||||
self.nodes = nodes
|
self.nodes = nodes
|
||||||
self.customvalues = customvalues
|
self.customvalues = customvalues
|
||||||
|
|
||||||
|
self.bgm = self.game.sound_lib["bgm/overworld.mp3"]
|
||||||
|
self.bgm.play(-1)
|
||||||
|
|
||||||
self.launched = False
|
self.launched = False
|
||||||
|
|
||||||
self.blueflags = self.game.getSpriteDir("flags/blue/")
|
self.blueflags = self.game.getSpriteDir("flags/blue/")
|
||||||
@ -77,6 +80,7 @@ class Levels(BaseObject):
|
|||||||
else:
|
else:
|
||||||
self.game.globals["levellore"] = None
|
self.game.globals["levellore"] = None
|
||||||
self.game.gameloop.summon(t)
|
self.game.gameloop.summon(t)
|
||||||
|
self.bgm.stop()
|
||||||
self.cursor = min(self.cursor,len(self.nodes)-1)
|
self.cursor = min(self.cursor,len(self.nodes)-1)
|
||||||
self.cursor = max(0,self.cursor)
|
self.cursor = max(0,self.cursor)
|
||||||
|
|
||||||
|
BIN
gamedata/sounds/bgm/overworld.mp3
Normal file
BIN
gamedata/sounds/bgm/overworld.mp3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user