Beispiel #1
0
def startApp():
	# get saved data before game start
	screenSize = Data.getData("screenSize");
	Global.setScreenSize(screenSize[0], screenSize[1]);

	settings = pygame.HWSURFACE;
	isFullScreen = Data.getData("fullscreen");
	if isFullScreen == "True":
		settings = settings | pygame.FULLSCREEN;
		Global.setScreenSize(infoObject.current_w, infoObject.current_h);


	Global.screen = pygame.display.set_mode(Global.screenSize, settings);
	startMenu();
	initGame();
Beispiel #2
0
def startMenu():
	# global vars
	GlobalVars.setActive();

	# world
	world = World();

	# camera
	cam = Camera(world);
	Render.setCamera(cam);
	cameraBehaviour.setCamera(cam);


	Global.isApplicationRunning = True;

	# sounds
	GlobalVars.getVar("sounds")['thunder'].play();
	GlobalVars.getVar("sounds")['creepy'].play();

	# menu behaviour
	menuBehaviour.setActive(True);
	menuBehaviour.open();

	menuBehaviour.assign("play", menuBehaviour.playMenu);
	menuBehaviour.assign("settings", startSettings);
	menuBehaviour.assign("credits", startCredits);
	menuBehaviour.assign("quit", doQuit);
	menuBehaviour.assign("continue", continueGame);
	menuBehaviour.assign("new", startNewGame);

	newGame = Data.getData("isNewGame");
	menuBehaviour.setNewGame(newGame);
    def __init__(self, keyName):
        self.name = keyName
        self.keys = Data.getData("k_" + keyName)

        global events
        # check if the keyname already exists, if not create a new one
        if not self.name in events:
            events[self.name] = {
                "keys": self.keys,
                "functions": []
            }
	def __init__(self, keyName):
		self.name = keyName;
		self.keys = Data.getData("k_" + keyName);

		global events;
		# check if the keyname already exists, if not create a new one
		if not self.name in events:
			events[self.name] = {
				"keys" : self.keys,
				"functions" : []
			};
Beispiel #5
0
def startGame():
	inventoryBehaviour.setActive(True);

	# def saySomething():
	# 	print("HELLO WORLD!!!!");

	# myItem = Item("Test", "A test item", "assets/icons/inventory/test.png");
	# myItem.onSelection(saySomething);


	# playerInventory.addItem(myItem);
	# playerInventory.addItem(Item("Un autre truc", "Une description un peu plus longue..", "assets/icons/inventory/test.png"));

	# debug active
	Debug.setActive(True);

	# action dispatcher active
	actiondispatcherBehaviour.setActive(True);

	playerBehaviour.setActive();

	# load a scene for test
	sceneBehaviour.setActive();

	# check if the user have a saved game
	newGame = Data.getData("isNewGame");
	mainScene = None;
	if not (newGame):
		lastScene = Data.getData("lastScene");
		position = Data.getData("lastPosition");

		mainScene = Scene(lastScene);
		sceneBehaviour.setCurrentScene(mainScene);

		playerBehaviour.getPlayer().setPosition(position[0], position[1]);
		print("Last game has been loaded");

	else:
		# start a normal game
		mainScene = Scene("scene2");
		sceneBehaviour.setCurrentScene(mainScene);


	# character behaviour active
	characterBehaviour.setActive(True);

	# enable dialog system
	dialogBehaviour.setActive(True);

	# background behaviour
	backgroundBehaviour.setActive(True);

	# achievement behaviour
	achievementBehaviour.setActive(True);

	myAchievement = Achievement("Secretariat", "Vous devez aller au secretariat", lambda:print("YOUDIDIT"));
	achievementBehaviour.setAchievement(myAchievement);
	myAchievement.done();

	# pause behaviour
	pauseBehaviour.setActive(True);
	Global.isApplicationRunning = True;
	isGameStarting = False;