Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- WIDTH = 512
- HEIGHT = 416
- FPS = 20
- VERSION = "0.0.3"
- FULLSCREEN = False
- import pygame,sys,os,time
- pygame.init()
- display = pygame.display.set_mode((WIDTH,HEIGHT), pygame.DOUBLEBUF)
- alpha_display = display.convert_alpha()
- fpsClock = pygame.time.Clock()
- keyPressed = 0
- sys.path.insert(0, "scripts/")
- from pygame.locals import *
- from media import *
- import color
- import menu
- def run():
- display.fill(color.BLACK)
- if (menu.active == True):
- menu.update()
- else:
- pass
- while (True): # Code to run loop
- for event in pygame.event.get():
- if (event.type == QUIT):
- pygame.quit()
- sys.exit()
- if (event.type == pygame.KEYDOWN):
- time.sleep(0.1)
- keyPressed = event.key
- elif (event.type == pygame.KEYUP):
- keyPressed = 0
- run()
- pygame.display.update()
- fpsClock.tick(FPS)
- from __main__ import *
- page = "main"
- selObj = 1
- active = True
- class o:
- dee = False
- def update():
- if o.dee == False:
- o.dee = True
- global page
- global selObj
- global active
- if page == "main": # Main menu
- if (keyPressed == pygame.K_RETURN):
- if (selObj == 1):
- page = "singleplayer"
- elif (selObj == 2):
- pygame.quit()
- sys.exit()
- if (keyPressed == pygame.K_UP):
- selObj -= 1
- elif (keyPressed == pygame.K_DOWN):
- selObj += 1
- display.blit(img.mainmenubg,(0,0))
- if (selObj >= 3):
- selObj = 1
- elif (selObj <= 0):
- selObj = 2
- if (selObj == 1):
- print("test1"
- elif (selObj == 2):
- print("test2")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement