Permalink
Browse files

added menu help

  • Loading branch information...
1 parent ab30fcb commit 0e1f63d2796d3617bb6a08b1b0771f7cddccf3c1 michael committed Jun 25, 2012
View
@@ -1,8 +1,8 @@
(dp0
S'sound'
p1
-I00
+I01
sS'resolution'
p2
-I00
+I01
s.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -13,24 +13,29 @@
##self.font = pygame.font.Font(None,64)
#self.textHeight=self.y1-80
+def negtozero ( x):
+ if x<0:
+ return 0
+ return x
-def updateProgbar(percent,x1, y1,max_width, color, direction):
+def updateProgbar(percent,x1, y1,max_width, color, direction, single_sprites):
s = pygame.Surface((max_width,15)) # the size of your rect
s.set_alpha(64) # alpha level
s.fill(color) # this fills the entire surface
screen.blit(s, (x1,y1)) # (0,0) are the top-left coordinates
-
- #s = pygame.Surface(((percent*max_width)/100,15)) # the size of your rect
- #s.set_alpha(128) # alpha level
- #s.fill(color2) # this fills the entire surface
- #screen.blit(s, (x1,y1)) # (0,0) are the top-left coordinates
##txtpercent = self.font.render(str(percent)+"%", True, self.color)
##screen.blit(txtpercent, (20,y1+30))
+ (r, g, b) = color
if direction==1:
- pygame.draw.rect(screen, color, (x1,y1,(percent*max_width)/100,15), 0)
+ for i in range((percent*max_width)/100):
+ screen.blit(single_sprites['barArmor.png'],(x1+i,y1))
+ # pygame.draw.rect(screen, newcol, (x1,y1+i,(percent*max_width)/100,2), 0)
+
else:
- pygame.draw.rect(screen, color, (x1+(max_width-(percent*max_width)/100),y1,(percent*max_width)/100,15), 0)
+ for i in range((percent*max_width)/100):
+ screen.blit(single_sprites['barLife.png'],(x1+max_width-i,y1))
+ #pygame.draw.rect(screen, color, (x1+(max_width-(percent*max_width)/100),y1,(percent*max_width)/100,15), 0)
#pygame.draw.rect(screen, color2, (x1,y1,max_width,15), 1 )
@@ -63,12 +68,12 @@ def blit(self, ship, level):
#print(common_pygame.screenheight)
#progress bar for the armor
- updateProgbar(ship.armor,25, common_pygame.screenheight-23, 150, (7,200,0), 1)
+ updateProgbar(ship.armor,25, common_pygame.screenheight-23, 150, (7,200,0), 1, self.single_sprites)
screen.blit(self.single_sprites['armorbonus.png'],(0,common_pygame.screenheight-32))
#progress bar for the life
updateProgbar(ship.life,common_pygame.screenwidth-25-150,
- common_pygame.screenheight-23, 150, (0,181,200), 0)
+ common_pygame.screenheight-23, 150, (0,181,200), 0, self.single_sprites)
screen.blit(self.single_sprites['lifebonus.png'],(common_pygame.screenwidth-25,common_pygame.screenheight-32))
@@ -51,7 +51,7 @@ def load_resources(pygame_arg):
"menu_resumeblurry.png", "menu_quit.png", "menu_quitblurry.png","menu_sound.png", \
"menu_on.png", "menu_off.png","menu_resolution.png","menu_800600.png", "menu_800500.png", \
"sprite_enemy2.png", "plasmaBonusRing.png", "plasmabonus.png", "boss1.png", \
- "particle1.png", "particle2.png", "particle3.png", "particle4.png" ]
+ "particle1.png", "particle2.png", "particle3.png", "particle4.png", "barArmor.png", "barLife.png" ]
for index in xrange (len(sprite_load_list)):
add_sprite(sprite_load_list[index])
View
@@ -51,6 +51,7 @@ def init2(self, single_sprites, sounds, background, hud):
#1: option menu
self.menustatus=0
self.font = pygame.font.Font(None,32)
+ self.littlefont = pygame.font.Font(None,25)
#self.config={}
self.hud=hud
# if self.config['resolution']==0:
@@ -111,6 +112,23 @@ def launch(self, withresume):
if self.menustatus==0:
+
+ #blit the help
+ s = pygame.Surface((300,300)) # the size of your rect
+ s.set_alpha(64) # alpha level
+ s.fill((255, 255, 255)) # this fills the entire surface
+ screen.blit(s, (25,150)) # (0,0) are the top-left coordinates
+ screen.blit(self.littlefont.render("Use the arrow keys and enter", \
+ True, (255,255, 255)),(30,155))
+ screen.blit(self.littlefont.render("to navigate the menu. ", \
+ True, (255,255, 255)),(30,175))
+ screen.blit(self.littlefont.render("Game controls : ", \
+ True, (255,128, 128)),(30,210))
+ screen.blit(self.littlefont.render("Arrow keys : move your ship ", \
+ True, (255,255, 255)),(30,230))
+ screen.blit(self.littlefont.render("space : fire ", \
+ True, (255,255, 255)),(30,250))
+
if pygame.key.get_pressed()[pygame.K_RETURN] and self.selection==1 and self.compteur>=5:
self.compteur=0
effects.fadeToColor(0, 0, 0)
View
@@ -6,7 +6,7 @@
class progressBar():
def __init__(self):
- self.color=(0, 0, 255)
+ self.color=(102, 170, 255)
self.y1 = screen.get_height()/2
self.y2 = self.y1 +20
self.max_width=800-40

0 comments on commit 0e1f63d

Please sign in to comment.