PinmikPanik/gamedata/scenes.py

59 lines
2.3 KiB
Python
Raw Normal View History

2021-09-10 19:22:30 +02:00
from gamedata.objects.menu.mainmenu import MainMenu
from gamedata.objects.bg.movingbackground import MovingBackground
from gamedata.objects.bg.menubackground import MenuBackground
from gamedata.objects.menu.optionmenu import OptionMenu
from gamedata.objects.sliders.bgmslider import BGMSlider
from gamedata.objects.sliders.sfxslider import SFXSlider
2021-09-10 21:33:24 +02:00
from gamedata.objects.ingame.lemmings import Lemming
2021-09-11 14:33:20 +02:00
from gamedata.objects.ingame.manager import Manager
2021-09-13 19:13:54 +02:00
from gamedata.objects.gameover import GameOver
2021-09-16 08:19:35 +02:00
from gamedata.objects.ingame.skies import Skies
from gamedata.objects.ingame.clouds import Clouds
2021-09-19 15:58:01 +02:00
from gamedata.objects.resetbutton import Reset
2021-09-19 20:29:24 +02:00
from gamedata.objects.rescalebutton import Rescale
2021-09-10 19:22:30 +02:00
def main(game):
game.scaleCamera()
2021-09-10 21:33:24 +02:00
game.gameloop.reinit()
2021-09-10 19:22:30 +02:00
bg = MenuBackground(game)
2021-09-16 08:19:35 +02:00
skies = Skies(game)
# Clouds in the background
clouds = Clouds(game,game.DISPLAY_WIDTH,speed=30,cameraratio=0.05)
cloudsdark = Clouds(game,game.DISPLAY_WIDTH,speed=10,cameraratio=0.02,spritename="cloudsdark.png")
game.gameloop.summon(cloudsdark)
game.gameloop.summon(clouds)
2021-09-10 19:22:30 +02:00
menu = MainMenu(game.DISPLAY_WIDTH/4,round(game.DISPLAY_HEIGHT*3/8),game,game.DISPLAY_WIDTH//2,game.DISPLAY_HEIGHT//2)
2021-09-16 08:19:35 +02:00
game.gameloop.summon(skies)
2021-09-10 19:22:30 +02:00
game.gameloop.summon(bg)
game.gameloop.summon(menu)
2021-09-10 21:33:24 +02:00
def ingame(game):
game.gameloop.reinit()
2021-09-14 17:01:58 +02:00
game.globals["camerax"] = 0
game.globals["cameray"] = 0
2021-09-11 14:33:20 +02:00
game.gameloop.summon(Manager(game))
2021-09-19 22:12:52 +02:00
game.sound_lib["bgm/menu.ogg"].stop()
game.sound_lib["bgm/ingame.ogg"].play(-1)
2021-09-10 21:33:24 +02:00
2021-09-10 19:22:30 +02:00
def options(game):
2021-09-16 08:34:40 +02:00
game.gameloop.delname("Button")
game.gameloop.delname("MainMenu")
2021-09-10 19:22:30 +02:00
game.globals["camerax"] = 0
game.globals["cameray"] = 0
s = BGMSlider(40,40,game,400,40)
s2 = SFXSlider(40,100,game,400,40)
2021-09-19 20:29:24 +02:00
btn = Rescale(40,160 ,game,400,40)
btn2 = Reset(40,220,game,400,40)
2021-09-10 19:22:30 +02:00
menu = OptionMenu(round(game.DISPLAY_WIDTH/8),round(game.DISPLAY_HEIGHT*9/10),game,round(game.DISPLAY_WIDTH*6/8),round(game.DISPLAY_HEIGHT/10-game.DISPLAY_HEIGHT/30))
game.gameloop.summon(s)
game.gameloop.summon(s2)
2021-09-19 15:58:01 +02:00
game.gameloop.summon(btn)
2021-09-19 20:29:24 +02:00
game.gameloop.summon(btn2)
2021-09-16 08:34:40 +02:00
game.gameloop.summon(menu)
2021-09-13 19:13:54 +02:00
def gameover(game):
game.gameloop.reinit()
go = GameOver(game)
game.gameloop.summon(go)
2021-09-19 22:12:52 +02:00
game.sound_lib["bgm/ingame.ogg"].stop()