コード例 #1
0
	def define(self):
		sX = Global.screenSize[0];
		sY = Global.screenSize[1];

		self.elements['background'] = Image("assets/darker.png");
		self.elements['background'].setPosition(0, sY/2);
		self.elements['background'].setSize(sX, sY/2);

		self.elements['characterFace'] = Image("assets/characters/test/face.png");
		self.elements['characterFace'].setPosition(0.05*sX, 0.78 * sY);
		self.elements['characterFace'].setSize(0.1*sX, 0.1*sX);
		self.elements['characterFace'].setDepth(5);

		self.elements['author'] = Text("None", "arial");
		self.elements['author'].setPosition(0.2*sX,0.82*sY);
		self.elements['author'].setColor((255,255,255));
		self.elements['author'].setFontSize(20);
		self.elements['author'].setDepth(5);

		self.elements['text'] = Text("None", "arial");
		self.elements['text'].setPosition(0.2*sX,0.87*sY);
		self.elements['text'].setColor((255,255,255));
		self.elements['text'].setFontSize(16);
		self.elements['text'].setDepth(5);

		self.elements['help'] = Text("( Press 'Enter' to skip )", "arial");
		self.elements['help'].setPosition(0.2*sX,0.92*sY);
		self.elements['help'].setColor((200,200,200));
		self.elements['help'].setFontSize(12);
		self.elements['help'].setDepth(5);
コード例 #2
0
    def define(self):
        sX = Global.screenSize[0]
        sY = Global.screenSize[1]

        self.elements['background'] = Image("assets/darker.png")
        self.elements['background'].setPosition(0.1 * sX, 0.3 * sY)
        self.elements['background'].setSize(0.8 * sX, 0.7 * sY)

        self.elements['face'] = Image("assets/characters/william/face.png")
        self.elements['face'].setPosition(0.1 * sX, 0.15 * sY)
        self.elements['face'].setSize(0.1 * sX, 0.1 * sX)

        self.elements['title'] = Text("Inventaire", "arial")
        self.elements['title'].setFontSize(30)
        self.elements['title'].setDepth(3)
        self.elements['title'].setPosition(0.22 * sX, 0.15 * sY)

        self.elements['description1'] = Text(
            "Tous les items que vous avez récoltés au cours de votre aventure.",
            "arial")
        self.elements['description1'].setFontSize(18)
        self.elements['description1'].setColor((230, 230, 230))
        self.elements['description1'].setDepth(3)
        self.elements['description1'].setPosition(0.22 * sX, 0.21 * sY)

        self.elements['description2'] = Text(
            "( Appuyez sur 'F' pour ouvrir / fermer l'inventaire )", "arial")
        self.elements['description2'].setFontSize(15)
        self.elements['description2'].setColor((230, 230, 230))
        self.elements['description2'].setDepth(3)
        self.elements['description2'].setPosition(0.22 * sX, 0.25 * sY)
コード例 #3
0
	def __init__(self, category, x, y):
		super().__init__();
		self.category = category;
		self.setPosition(x, y);

		# add texture to the wall
		texture = Image("assets/elements/wall/" + category + ".png");
		if texture:
			self.assignDrawable(texture);
			self.size = texture.getSize();
コード例 #4
0
    def __init__(self, category, x, y):
        super().__init__()
        self.category = category
        self.setPosition(x, y)

        # add texture to the wall
        texture = Image("assets/elements/wall/" + category + ".png")
        if texture:
            self.assignDrawable(texture)
            self.size = texture.getSize()
コード例 #5
0
    def define(self):
        sX = Global.screenSize[0]
        sY = Global.screenSize[1]

        self.elements['background'] = Image("assets/darker.png")
        self.elements['background'].setPosition(0.29 * sX, 0.3 * sY)
        self.elements['background'].setSize(0.42 * sX, 0.7 * sY)
        self.elements['background'].setDepth(2)

        self.elements['title'] = Text("Pause", "arial")
        self.elements['title'].setFontSize(50)
        self.elements['title'].setDepth(3)
        self.elements['title'].setPosition(0.3 * sX, 0.25 * sY)

        self.elements['objective_title'] = Text("Votre objectif actuel:",
                                                "arial")
        self.elements['objective_title'].setFontSize(30)
        self.elements['objective_title'].setDepth(3)
        self.elements['objective_title'].setPosition(0.3 * sX, 0.35 * sY)

        self.elements['current_objective'] = Text("", "arial")
        self.elements['current_objective'].setFontSize(18)
        self.elements['current_objective'].setColor((230, 230, 230))
        self.elements['current_objective'].setDepth(3)
        self.elements['current_objective'].setPosition(0.3 * sX, 0.42 * sY)

        self.elements['save_button_background'] = Image("assets/darker2.png")
        self.elements['save_button_background'].setPosition(
            0.3 * sX, 0.55 * sY)
        self.elements['save_button_background'].setSize(0.4 * sX, 0.05 * sX)
        self.elements['save_button_background'].setDepth(3)
        self.elements['save_button_background'].setVisible(False)
        self.elements['save_button_label'] = Text("Save the game", "arial")
        self.elements['save_button_label'].setFontSize(18)
        self.elements['save_button_label'].setColor((230, 230, 230))
        self.elements['save_button_label'].setDepth(4)
        self.elements['save_button_label'].setAlign("center")
        self.elements['save_button_label'].setPosition(0.5 * sX, 0.575 * sY)

        self.elements['quit_button_background'] = Image("assets/darker2.png")
        self.elements['quit_button_background'].setPosition(
            0.3 * sX, 0.65 * sY)
        self.elements['quit_button_background'].setSize(0.4 * sX, 0.05 * sX)
        self.elements['quit_button_background'].setDepth(3)
        self.elements['quit_button_background'].setVisible(False)
        self.elements['quit_button_label'] = Text("Quit", "arial")
        self.elements['quit_button_label'].setFontSize(18)
        self.elements['quit_button_label'].setColor((230, 230, 230))
        self.elements['quit_button_label'].setDepth(4)
        self.elements['quit_button_label'].setAlign("center")
        self.elements['quit_button_label'].setPosition(0.5 * sX, 0.675 * sY)
コード例 #6
0
	def __init__(self, category, x, y, number = None):
		super().__init__();
		self.category = category;
		self.setPosition(x, y);
		self.number = None;
		
		# add texture to the door
		texture = Image("assets/elements/doors/" + category + ".png");
		if texture:
			self.assignDrawable(texture);
			self.size = texture.getSize();

		# add the number in the door
		self.setNumber(number);
コード例 #7
0
	def __init__(self, name = None, description = None, iconPath = None):
		
		self.setName(name);
		self.setDescription(description);
		self.functionsToCallWhenAction = [];
		self.icon = None;

		# icon
		if iconPath != None:
			drawable = Image(iconPath);
			self.icon = drawable;
コード例 #8
0
    def __init__(self, type, x, y):
        super().__init__()
        self.setType("pickup")

        # add texture
        texture = Image("assets/dickbutt.png")
        texture.setSize(64, 64)
        if texture:
            texture.setDepth(10)
            self.assignDrawable(texture)
            self.size = texture.getSize()

        self.setDepth(10)
コード例 #9
0
    def define(self):
        sX = Global.screenSize[0]
        sY = Global.screenSize[1]

        self.elements['background'] = Image("assets/dot.png")
        self.elements['background'].setPosition(0, 0)
        self.elements['background'].setSize(sX, sY)
        self.elements['background'].setDepth(200)
        self.elements['background'].setOpacity(0)

        self.elements['title'] = Text("A test title", "arial")
        self.elements['title'].setPosition(0.1 * sX, 0.75 * sY)
        self.elements['title'].setColor((255, 255, 255))
        self.elements['title'].setFontSize(40)
        self.elements['title'].setDepth(201)
コード例 #10
0
    def __init__(self):
        self.backgroundElement = None
        self.dynamicElements = []

        screenSize = Global.getScreenSize()

        self.fade = {
            "direction": None,
            "interval": None,
            "running": False,
            "element": Image("assets/dot.png")
        }

        self.fade['element'].setSize(screenSize[0], screenSize[1])
        self.fade['element'].setDepth(300)
        self.fade['element'].setAffectedByCamera(False)
        self.fade['element'].setOpacity(0)
コード例 #11
0
	def __init__(self, type, x, y):
		super().__init__();
		self.setType("pickup");

		# add texture
		texture = Image("assets/dickbutt.png");
		texture.setSize(64,64);
		if texture:
			texture.setDepth(10);
			self.assignDrawable(texture);
			self.size = texture.getSize();

		self.setDepth(10);
コード例 #12
0
    def __init__(self, position, targetScene, targetPosition):
        super().__init__()
        self.setType("teleportation")

        self.uniqid = uuid.uuid4()
        self.action = ActionDispatcher(self.uniqid, position[0], position[1])
        self.receiver = ActionReceiver(self.uniqid)
        self.receiver.on(self.doTeleport)

        texture = Image("assets/icons/door.png")
        texture.setSize(64, 64)
        texture.setOffsetPosition(93, 300)
        texture.setDepth(101)
        self.assignDrawable(texture)

        self.setPosition(position[0], position[1])

        self.targetScene = targetScene
        self.targetPosition = targetPosition

        Render.set(texture)
コード例 #13
0
    def updateEntries(self):
        self.update()
        for entry in self.entries:
            for element in self.elements:
                if element == entry:
                    type = self.elements[element].getType()
                    if type == "text":
                        text = self.getEntry(element)
                        self.elements[element].setValue(text)
                    elif type == "image":

                        sX = Global.screenSize[0]
                        sY = Global.screenSize[1]
                        character = self.getEntry(element)
                        print("Current character speaking:", character)

                        tempImage = Image("assets/characters/" + character +
                                          "/face.png")
                        tempImage.setPosition(0.05 * sX, 0.78 * sY)
                        tempImage.setSize(0.1 * sX, 0.1 * sX)
                        tempImage.setDepth(5)
                        self.elements[element] = tempImage
コード例 #14
0
    def create(self):
        sX = Global.screenSize[0]
        sY = Global.screenSize[1]

        self.setEntry("currentLine", 1)
        items = self.getEntry("items")

        i = 0
        for item in items:
            name = item.getName()
            description = item.getDescription()

            self.elements[name + 'face'] = item.getIcon()
            self.elements[name + 'face'].setPosition(
                0.12 * sX, 0.4 * sY + (0.075 * sX) * i + i)
            self.elements[name + 'face'].setSize(0.06 * sX, 0.06 * sX)
            self.elements[name + 'face'].setDepth(4)

            self.elements[name + 'darker'] = Image("assets/darker2.png")
            self.elements[name + 'darker'].setPosition(
                0.11 * sX, 0.39 * sY + (0.075 * sX) * i + i)
            self.elements[name + 'darker'].setSize(0.78 * sX, 0.075 * sX)
            self.elements[name + 'darker'].setDepth(3)
            self.elements[name + 'darker'].setVisible(False)

            self.elements[name + 'name'] = Text(name, "arial")
            self.elements[name + 'name'].setFontSize(20)
            self.elements[name + 'name'].setDepth(4)
            self.elements[name + 'name'].setPosition(
                0.2 * sX, 0.4 * sY + (0.075 * sX) * i + i)

            self.elements[name + 'description'] = Text(description, "arial")
            self.elements[name + 'description'].setFontSize(15)
            self.elements[name + 'description'].setDepth(4)
            self.elements[name + 'description'].setPosition(
                0.2 * sX, 0.45 * sY + (0.075 * sX) * i + i)
            i += 1

        self.setEntry("numberOfItems", i)

        super().create()
コード例 #15
0
	def __init__(self, position, targetScene, targetPosition):
		super().__init__();
		self.setType("teleportation");

		self.uniqid = uuid.uuid4();
		self.action = ActionDispatcher(self.uniqid, position[0], position[1]);
		self.receiver = ActionReceiver(self.uniqid);
		self.receiver.on(self.doTeleport);

		texture = Image("assets/icons/door.png");
		texture.setSize(64,64);
		texture.setOffsetPosition(93,300);
		texture.setDepth(101);
		self.assignDrawable(texture);

		self.setPosition(position[0], position[1]);

		self.targetScene = targetScene;
		self.targetPosition = targetPosition;
		
		Render.set(texture);		
コード例 #16
0
	def updateEntries(self):
		self.update();
		for entry in self.entries:
			for element in self.elements:
				if element == entry:
					type = self.elements[element].getType();
					if type == "text":
						text = self.getEntry(element);
						self.elements[element].setValue(text);
					elif type == "image":

						sX = Global.screenSize[0];
						sY = Global.screenSize[1];
						character = self.getEntry(element);
						print("Current character speaking:", character);

						tempImage = Image("assets/characters/" + character + "/face.png");
						tempImage.setPosition(0.05*sX, 0.78 * sY);
						tempImage.setSize(0.1*sX, 0.1*sX);
						tempImage.setDepth(5);
						self.elements[element] = tempImage;
コード例 #17
0
    def define(self):
        sX = Global.screenSize[0]
        sY = Global.screenSize[1]

        self.elements['background'] = Image("assets/homescreen.png")
        self.elements['background'].setPosition(0, 0)
        self.elements['background'].setSize(1 * sX, 1 * sY)
        self.elements['background'].setDepth(22)

        self.elements['sky'] = Image("assets/sky.png")
        self.elements['sky'].setPosition(0, 0)
        self.elements['sky'].setSize(1 * sX, 1 * sY)
        self.elements['sky'].setDepth(21)
        self.elements['sky'].setVisible(False)

        self.elements['sky_darker'] = Image("assets/sky_darker.png")
        self.elements['sky_darker'].setPosition(0, 0)
        self.elements['sky_darker'].setSize(1 * sX, 1 * sY)
        self.elements['sky_darker'].setDepth(20)
        self.elements['sky_darker'].setVisible(False)

        self.elements['menu_background'] = Image("assets/dot.png")
        self.elements['menu_background'].setPosition(0, 0)
        self.elements['menu_background'].setSize(0.5 * sX, 1 * sY)
        self.elements['menu_background'].setDepth(23)
        self.elements['menu_background'].setOpacity(0.25)

        self.elements['logo'] = Image("assets/logo_white.png")
        self.elements['logo'].setPosition(
            ((0.5 * sX) / 2) - ((0.5 * sX) - 180) / 2, 60)
        self.elements['logo'].setSize((0.5 * sX) - 180,
                                      ((0.5 * sX) - 180) / (649 / 186))
        self.elements['logo'].setDepth(24)

        button_width = (0.5 * sX) - 180
        button_height = ((0.5 * sX) - 180) / (269 / 68)

        # play button
        self.elements['play_background'] = Image("assets/white.png")
        self.elements['play_background'].setPosition(
            ((0.5 * sX) / 2) - ((0.5 * sX) - 180) / 2,
            60 + ((0.5 * sX) - 180) / (649 / 186) + 20)
        self.elements['play_background'].setSize(button_width, button_height)
        self.elements['play_background'].setDepth(24)
        self.elements['play_background'].setVisible(False)

        self.elements['play_text'] = Text("Jouer", "arial")
        self.elements['play_text'].setFontSize(25)
        self.elements['play_text'].setColor((43, 56, 66))
        self.elements['play_text'].setDepth(25)
        self.elements['play_text'].setAlign("center")
        self.elements['play_text'].setPosition(
            ((0.5 * sX) / 2), 60 + ((0.5 * sX) - 180) / (649 / 186) + 20 +
            button_height / 2 - 20)

        # settings button
        self.elements['settings_background'] = Image("assets/white.png")
        self.elements['settings_background'].setPosition(
            ((0.5 * sX) / 2) - ((0.5 * sX) - 180) / 2,
            self.elements['play_background'].position[1] + 80)
        self.elements['settings_background'].setSize(button_width,
                                                     button_height)
        self.elements['settings_background'].setDepth(24)
        self.elements['settings_background'].setVisible(False)

        self.elements['settings_text'] = Text("Paramètres", "arial")
        self.elements['settings_text'].setFontSize(25)
        self.elements['settings_text'].setColor((43, 56, 66))
        self.elements['settings_text'].setDepth(25)
        self.elements['settings_text'].setAlign("center")
        self.elements['settings_text'].setPosition(
            ((0.5 * sX) / 2), self.elements['play_text'].position[1] + 80)

        # credits button
        self.elements['credits_background'] = Image("assets/white.png")
        self.elements['credits_background'].setPosition(
            ((0.5 * sX) / 2) - ((0.5 * sX) - 180) / 2,
            self.elements['settings_background'].position[1] + 80)
        self.elements['credits_background'].setSize(button_width,
                                                    button_height)
        self.elements['credits_background'].setDepth(24)
        self.elements['credits_background'].setVisible(False)

        self.elements['credits_text'] = Text("Crédits", "arial")
        self.elements['credits_text'].setFontSize(25)
        self.elements['credits_text'].setColor((43, 56, 66))
        self.elements['credits_text'].setDepth(25)
        self.elements['credits_text'].setAlign("center")
        self.elements['credits_text'].setPosition(
            ((0.5 * sX) / 2), self.elements['settings_text'].position[1] + 80)

        # quit button
        self.elements['quit_background'] = Image("assets/white.png")
        self.elements['quit_background'].setPosition(
            ((0.5 * sX) / 2) - ((0.5 * sX) - 180) / 2,
            self.elements['credits_background'].position[1] + 80)
        self.elements['quit_background'].setSize(button_width, button_height)
        self.elements['quit_background'].setDepth(24)
        self.elements['quit_background'].setVisible(False)

        self.elements['quit_text'] = Text("Quitter", "arial")
        self.elements['quit_text'].setFontSize(25)
        self.elements['quit_text'].setColor((43, 56, 66))
        self.elements['quit_text'].setDepth(25)
        self.elements['quit_text'].setAlign("center")
        self.elements['quit_text'].setPosition(
            ((0.5 * sX) / 2), self.elements['credits_text'].position[1] + 80)

        # game menu
        self.elements['game_background'] = Image("assets/dot.png")
        self.elements['game_background'].setPosition(
            0.5 * sX + 20, 60 + ((0.5 * sX) - 180) / (649 / 186) + 20)
        self.elements['game_background'].setSize(0.5 * sX - 40, 160)
        self.elements['game_background'].setDepth(25)
        self.elements['game_background'].setOpacity(0.25)
        self.elements['game_background'].setVisible(False)

        self.elements['continue_background'] = Image("assets/white.png")
        self.elements['continue_background'].setPosition(
            0.5 * sX + 20, self.elements['game_background'].position[1])
        self.elements['continue_background'].setSize(0.5 * sX - 40,
                                                     button_height)
        self.elements['continue_background'].setDepth(26)
        self.elements['continue_background'].setVisible(False)

        self.elements['continue_text'] = Text("Continuer", "arial")
        self.elements['continue_text'].setFontSize(25)
        self.elements['continue_text'].setColor((243, 243, 243))
        self.elements['continue_text'].setDepth(27)
        self.elements['continue_text'].setAlign("center")
        self.elements['continue_text'].setVisible(False)
        self.elements['continue_text'].setPosition(
            ((0.5 * sX) / 2) + 0.5 * sX + 20,
            self.elements['game_background'].position[1] + 20)

        self.elements['new_background'] = Image("assets/white.png")
        self.elements['new_background'].setPosition(
            0.5 * sX + 20,
            self.elements['continue_background'].position[1] + 80)
        self.elements['new_background'].setSize(0.5 * sX - 40, button_height)
        self.elements['new_background'].setDepth(26)
        self.elements['new_background'].setVisible(False)

        self.elements['new_text'] = Text("Nouvelle partie", "arial")
        self.elements['new_text'].setFontSize(25)
        self.elements['new_text'].setColor((243, 243, 243))
        self.elements['new_text'].setDepth(27)
        self.elements['new_text'].setAlign("center")
        self.elements['new_text'].setVisible(False)
        self.elements['new_text'].setPosition(
            ((0.5 * sX) / 2) + 0.5 * sX + 20,
            self.elements['continue_text'].position[1] + 80)

        global thunderInterval
        thunderInterval = Global.Interval(self.editSky, 1000)
コード例 #18
0
    def __init__(self, path, sceneWidth):
        super().__init__()

        self.setType("background")

        # texture
        texture = Image(path)
        texture.setDepth(0)

        # size
        self.assignDrawable(texture)
        self.setDepth(-10)

        # left
        leftPanel = Image("assets/dot.png")
        leftPanel.setSize(texture.getSize()[0] / 2, 400)
        leftPanel.setOffsetPosition(-texture.getSize()[0] / 2, 0)
        leftPanel.setAffectedByParent(False)
        self.assignDrawable(leftPanel)
        # right
        rightPanel = Image("assets/dot.png")
        rightPanel.setSize(texture.getSize()[0] / 2, 400)
        rightPanel.setOffsetPosition(sceneWidth, 0)
        rightPanel.setAffectedByParent(False)
        self.assignDrawable(rightPanel)
コード例 #19
0
    def __init__(self, path, sceneWidth):
        super().__init__()

        self.setType("background")

        # texture
        texture = Image(path)
        texture.setDepth(0)

        # size
        self.assignDrawable(texture)
        self.setDepth(-10)

        # left
        leftPanel = Image("assets/dot.png")
        leftPanel.setSize(texture.getSize()[0] / 2, 400)
        leftPanel.setOffsetPosition(-texture.getSize()[0] / 2, 0)
        leftPanel.setAffectedByParent(False)
        self.assignDrawable(leftPanel)
        # right
        rightPanel = Image("assets/dot.png")
        rightPanel.setSize(texture.getSize()[0] / 2, 400)
        rightPanel.setOffsetPosition(sceneWidth, 0)
        rightPanel.setAffectedByParent(False)
        self.assignDrawable(rightPanel)
コード例 #20
0
    def __init__(self):
        super().__init__()
        screenSize = Global.getScreenSize()

        background = Image("assets/cinematics/test.png")
        background.setSize(screenSize[0], screenSize[1])
        background.setDepth(200)

        character = Image("assets/characterTest.png")
        character.setPosition(100, 100)
        character.setSize(100, 100)
        character.setDepth(201)

        self.append(character, "character")

        self.moveElementTo("character", 200, 200, 2000)
        Global.setTimeout(self.whenArriveToEnd, 2000)

        self.setBackground(background)
コード例 #21
0
	def __init__(self):
		super().__init__();
		screenSize = Global.getScreenSize();

		background  = Image("assets/cinematics/test.png");
		background.setSize(screenSize[0], screenSize[1]);
		background.setDepth(200);

		character = Image("assets/characterTest.png");
		character.setPosition(100,100);
		character.setSize(100,100);
		character.setDepth(201);

		self.append(character, "character");

		self.moveElementTo("character", 200,200, 2000);
		Global.setTimeout(self.whenArriveToEnd, 2000);

		self.setBackground(background);