-
Notifications
You must be signed in to change notification settings - Fork 1
/
escena_menu.py
executable file
·133 lines (93 loc) · 3.68 KB
/
escena_menu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# -*- encoding: utf-8 -*-
# MEMO-Huayra es un fork de Memorice desarrollado para Huayra-gnu/linux
# 2013
# Desarrolladores:
# Mercedes Elgarte
# Héctor Sanchez
# Diego Accorinti
#
# license: lgplv3 (see http://www.gnu.org/licenses/lgpl.html)
# For pilas engine - a video game framework.
#
# copyright 2011 - Pablo Garrido
# license: lgplv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# website - http://www.pilas-engine.com.ar
import pilas
class EscenaMenu(pilas.escena.Base):
"Escena de presentacion del juego."
def __init__(self):
pilas.escena.Base.__init__(self)
def iniciar(self):
pilas.fondos.Fondo('data/menu.png')
self.titulo_de_juego()
self.menu_de_juego()
def titulo_de_juego(self):
self.titulo = pilas.actores.Actor('data/titulo.png')
self.titulo.y = 250
self.titulo.x = -80
self.titulo.y = [170], 0.8
def menu_de_juego(self):
# opcion = pilas.actores.Actor('data/opcion.png')
# opcion.x = 146
# opcion.y = 26
# animacion de cronometro
class variable:
intercambiar = True
def animacion_escala():
if variable.intercambiar == True:
self.titulo.escala = [0.2]
variable.intercambiar = False
else:
self.titulo.escala = [1.2]
variable.intercambiar = True
return True
pilas.mundo.agregar_tarea_siempre(0.2, animacion_escala)
# boton inicio
def presionamos_boton_inicio():
self.iniciar_juego()
def sobre_boton_inicio():
self.boton_inicio.pintar_sobre()
# opcion.x = 146
# opcion.y = 26
self.boton_inicio = pilas.actores.Boton(-550, 20, 'data/b_inicio.png', 'data/b_inicio_over.png','data/b_inicio_over.png')
self.boton_inicio.conectar_presionado(presionamos_boton_inicio)
self.boton_inicio.conectar_sobre(sobre_boton_inicio)
self.boton_inicio.conectar_normal(self.boton_inicio.pintar_normal)
self.boton_inicio.x = [-130]
# boton ayuda
def presionamos_boton_ayuda():
self.mostrar_ayuda()
def sobre_boton_ayuda():
self.boton_ayuda.pintar_sobre()
# opcion.x = 90
# opcion.y = -52
self.boton_ayuda = pilas.actores.Boton(-550, -53, 'data/b_ayuda.png', 'data/b_ayuda_over.png','data/b_ayuda_over.png')
self.boton_ayuda.conectar_presionado(presionamos_boton_ayuda)
self.boton_ayuda.conectar_sobre(sobre_boton_ayuda)
self.boton_ayuda.conectar_normal(self.boton_ayuda.pintar_normal)
self.boton_ayuda.x = [-160]
# boton salir
def presionamos_boton_salir():
self.salir_del_juego()
def sobre_boton_salir():
self.boton_salir.pintar_sobre()
# opcion.x = 21
# opcion.y = -119
self.boton_salir = pilas.actores.Boton(-550, -126, 'data/b_salir.png', 'data/b_salir_over.png','data/b_salir_over.png')
self.boton_salir.conectar_presionado(presionamos_boton_salir)
self.boton_salir.conectar_sobre(sobre_boton_salir)
self.boton_salir.conectar_normal(self.boton_salir.pintar_normal)
self.boton_salir.x = [-190]
def desactivar_botones(self):
self.boton_inicio.desactivar()
self.boton_ayuda.desactivar()
self.boton_salir.desactivar()
def iniciar_juego(self):
import escena_juego
pilas.cambiar_escena(escena_juego.Juego(nivel = 1))
def salir_del_juego(self):
pilas.terminar()
def mostrar_ayuda(self):
import escena_ayuda
pilas.cambiar_escena(escena_ayuda.Ayuda())