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);
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)
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)
def output(text): global currentLine textElement = Text(text, "arial") textElement.setPosition(20, 20 + currentLine * 20) textElement.setAffectedByCamera(False) Render.set(textElement) lines.append(textElement) currentLine += 1
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()
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)
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)