Beispiel #1
0
 def update(self):
     for i, item in enumerate(self.items):
         if item[0]:
             colours = palette(self.sel[0], self.sel[1])
         else:
             colours = palette(self.col[0], self.col[1])
         text = ' ' + item[1]
         spaces = ' ' * (self.width - len(text)) 
         text += spaces
         self.change_content(i, text + '\n', ALIGN_LEFT, colours)
Beispiel #2
0
 def update(self):
     for i, item in enumerate(self.items):
         if item[0]:
             colours = palette(self.sel[0], self.sel[1])
         else:
             colours = palette(self.col[0], self.col[1])
         text = ' ' + item[1]
         spaces = ' ' * (self.width - len(text)) 
         text += spaces
         self.change_content(i, text + '\n', ALIGN_LEFT, colours)
Beispiel #3
0
 def process_input(self, character):
     self.window.window.clear()
     if character == 263 and self.buffer:     # Handle backspace
         self.buffer = self.buffer[:-1]
     elif character == 10 or character == 13: # Handle the return key
         inputs = self.buffer.split("\n")
         if "menu" in inputs:
             menu = self.window.get("menu")
             menu.hidden = False if menu.hidden else True
             menu.active = True if not menu.active else False
         # Yup... Can launch ptpython with the "python" command.
         elif "python" in inputs:
             try:
                 from ptpython.repl import embed
                 self.window.stop()
                 l = {"pane": self, "window": self.window}
                 embed(locals=l, vi_mode=True)
                 self.buffer = ""
                 self.window.start()
             except:
                 pass
         elif "exit" in inputs:
             self.window.stop()
         self.buffer = ""
     else:
         try: self.buffer += chr(character)   # Append input to buffer
         except: pass
     import random
     colours = palette(-1, random.choice(["yellow","red"]))
     self.change_content(1, self.buffer, ALIGN_LEFT, colours)
Beispiel #4
0
 def update(self):
     if self.searching:
         self.change_content(0, "/"+self.buffer, palette("black", "white"))
     else:
         state = self.tagline
         state += ' ' * ((self.width /2) - len(self.tagline) - (len(str(self.status))/2))
         state += str(self.status)
         self.change_content(0, state)
Beispiel #5
0
 def update(self):
     if self.searching:
         self.change_content(0, "/"+self.buffer, palette("black", "white"))
     else:
         state = self.tagline
         state += ' ' * ((self.width /2) - len(self.tagline) - (len(str(self.status))/2))
         state += str(self.status)
         self.change_content(0, state)
Beispiel #6
0
    def update(self):
        h = self.window.player.mana

        amt = int(self.width * float(h[0]) / float(h[1]))
        
        healthbar = "Mana: %3.f/%i" % (h[0],h[1]) 
        healthbar += ' ' * (amt - len(healthbar))

        if h[0] < (h[1] / 4):
            colours = palette("black", "yellow")
#        elif h[0] < (h[1] / 2):
#            colours = palette("black", "yellow")
        else:
            colours = palette("black", "blue")

        self.change_content(0, healthbar, ALIGN_LEFT, colours)
        self.change_content(1, ' ' * int(self.width - len(healthbar)), ALIGN_LEFT, palette(-1,-1))
Beispiel #7
0
	def update(self):
		h = self.window.player.health
		if h[0] <= 0:
			self.window.stop()

		amt = int(self.width * float(h[0]) / float(h[1]))
		
		healthbar = "Health: %i/%i" % (h[0],h[1]) 
		healthbar += ' ' * (amt - len(healthbar))

		if h[0] < (h[1] / 3):
			colours = palette("black", "yellow")
		elif h[0] < (h[1] / 2):
			colours = palette("black", "red")
		else:
			colours = palette("black", "green")

		self.change_content(0, healthbar, ALIGN_LEFT, colours)
		self.change_content(1, ' ' * (self.width - len(healthbar)), ALIGN_LEFT, palette(-1,-1))
Beispiel #8
0
	def update(self):
		self.change_content(0, "You are likely to be eaten by a grue.", ALIGN_LEFT, palette("red"))
Beispiel #9
0
 def handle_fight(self):
     gamearea = self.window.get("gamearea")
     gamearea.change_content(0, "The Grue dissolved.", ALIGN_LEFT, palette(-1,-1))
Beispiel #10
0
 def update(self):
     if not self.content:
         self.change_content(0, self.intro, ALIGN_LEFT, palette(-1,-1))