Advertisement
DevUn

Engine.py

Dec 21st, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. #Engine: This will handle the title screen, loading saves, and play the actual game.
  2.  
  3. import pygame, sys
  4.  
  5. class Engine():
  6.     def __init__(self):
  7.         self.atTitle = True
  8.        
  9.     def playGame(self):
  10.         while self.atTitle is True:
  11.             self.titleScreen()
  12.    
  13.     def mainScreen(self):
  14.         screenWidth = 640
  15.         screenHeight = 480
  16.         self.screen = pygame.display.set_mode((screenWidth,screenHeight))
  17.         pygame.display.set_caption("Ixtli")
  18.    
  19.     def InitDisplay(self):
  20.         self.display.CreateScreen()
  21.         self.DisplayInitilized = 1
  22.    
  23.     def titleScreen(self):
  24.         self.gameTitle()
  25.         self.titleOptions("New Game", 300)
  26.         self.titleOptions("Continue", 325)
  27.         self.titleOptions("Honor", 350)
  28.         self.titleOptions("Quit", 375)
  29.         pygame.display.flip()
  30.        
  31.     def gameTitle(self):
  32.         titleFont = pygame.font.Font("slkscr.ttf", 30)
  33.         title = titleFont.render("Clocktower Lights", 1, (220,180,120))
  34.         titleRect = title.get_rect()
  35.         titleRect.centerx = self.screen.get_rect().centerx
  36.         titleRect.centery = 25
  37.         self.screen.blit(title, titleRect)
  38.        
  39.     def titleOptions(self, option, posY):
  40.         font = pygame.font.Font("slkscr.ttf", 18)
  41.         label = font.render(option, 1, (45,105,160))
  42.         titleRect = label.get_rect()
  43.         titleRect.centerx = self.screen.get_rect().centerx
  44.         titleRect.centery = posY
  45.         self.screen.blit(label, titleRect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement