Esempio n. 1
0
def check():
    f = open("email.txt", "r")
    text = f.readline(20)
    f = open("password.txt", "r")
    passw = f.readline(20)
    if (text == str(e1.get()) and passw == str(e2.get())):
        t = tkMessageBox.showinfo("alert", "Log in Successful")
        level()
    else:
        t = tkMessageBox.showinfo("alert", "Invalid username or password")
Esempio n. 2
0
def Load_level_1(screen, choice, P):  #Creates the level
    if choice == "normal":
        E1 = level(20, 948, 100, 20, black)
        El = [E1]
        L.i = 0
        return El, L.i
    elif choice == "custom":
        if L.w == 0:
            Origin_Block = level(0, 0, 1, 1, white)
            L.Done = level(1480, 940, 200, 40, green)
            E1 = level(20, 948, 100, 20, black)
            L.El.append(L.Done)
            L.El.append(E1)
            L.El.append(Origin_Block)
            L.w = 1
            Done.cert = Done.draw(screen, P)
            #for i in range(0, random.randint(2,12)):
            #    print("Haga: ", i)
            #    L.Star[i]=SC.Points()
            #    L.StarL.append(L.Star[i])
        if pygame.mouse.get_pressed()[0] == True:  #Left Click and drag to draw
            if L.id == 0:
                L.x, L.y = pygame.mouse.get_pos()
                print(L.x)
                print(L.y)
                L.j = 1
                L.id = 1
        if pygame.mouse.get_pressed()[2] == True:  #Left Click and drag to draw
            if L.id == 1:
                E = {}
                L.x1, L.y1 = pygame.mouse.get_pos()
                print(L.x1)
                print(L.y1)
                width = L.x1 - L.x
                height = L.y1 - L.y
                E[L.st] = level(L.x, L.y, width, height, black)
                L.El.append(E[L.st])
                L.st += 1
                L.j == 2
                L.id = 0

        if len(L.El) > 1000:
            L.i = 0
            L.El.remove(L.Done)
        if L.j == 2:
            L.j == 0
        if L.x > 1480 and L.x < 1720 and L.y > 940 and L.y < 1020:
            L.i = 2
            L.El.remove(L.Done)
        return L.El, L.i, L.StarL
Esempio n. 3
0
def main_menu():

    pygame.mixer.music.load(MUSIC_SCORE)
    pygame.mixer.music.play(-1)
    clevel = level(GAME_TITLE, SCREEN_WIDTH, SCREEN_HEIGHT)
    background_menu = objectGame(MENU_IMAGE, 0, 0, 1811, 996)
    background_menu.objDraw
    while not clevel.gameOver:
        clevel = level(GAME_TITLE, SCREEN_WIDTH, SCREEN_HEIGHT)
        clevel.game_screen.fill((110, 159, 211))
        background_menu.objDraw(clevel.game_screen)
        pygame.display.update()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                clevel.gameOver = 1
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE:
                    clevel.run_level_loop()
                if event.key == pygame.K_RETURN:
                    instruction(clevel)
                if event.key == pygame.K_KP_ENTER:
                    instruction(clevel)
Esempio n. 4
0
import pygame, sys, os, urllib, cStringIO
from pygame.locals import *
from level import *
pygame.init()

pygame.display.set_caption('t9k Unofficial Collaborative Game')

mainScreen = pygame.display.set_mode((736, 480))
mainScreen = pygame.display.get_surface()
background = pygame.Surface((mainScreen.get_width(), mainScreen.get_height()))

keyBindings = {'paused': "k_P"}

states = []
states.append(level())
# states.append(<all of the menus>)
# I really don't understand how Python's memory management system works, so this will probably be
# an inefficient way to use memory.

pygame.display.flip()

size = mainScreen.get_size()
paused = False

currentState = states[0]

#	Changing states:
# Every level and menu will need to have a "state" variable, and a load() and unload() method
# When you change a state, the current state will unload, then the new state will load
#	Potential problems:
# Loading a level will require input data (which level, save files).
Esempio n. 5
0
		if (player.vector[0] != -1):
			player.setmovevector((-1, player.vector[1]))
		player.startmoving()
	# SHOOT THINGS!
	if keys[pygame.K_SPACE]:
		if not player.dead:
			newproj = player.shoot()
			if newproj != False:
				projectiles.append(newproj)
	
	return True

#============== THE MAIN PART HERE =======================
now = pygame.time.get_ticks()

level = level("Greenhill Zone", Level1Enemies())

while(gameisrunning):

	currentTicks = pygame.time.get_ticks()

	if currentTicks - now > max_frame_time:
		now = currentTicks - step_size
	
	while(currentTicks - now >= step_size):

		#Game stuff!
		print now
		checkenemies(now)
		gameisrunning = checkevents()
		update(level)
Esempio n. 6
0
def run_level(input_file_name):
    #initializing pygame
    pygame.init()

    #constructing a level
    #class level is decsribed in level.py
    cur_level = level(input_file_name)

    #setting window size
    width = cur_level.width
    height = cur_level.height
    size = (width, height)
    #creating the screen
    screen = pygame.display.set_mode(size)
    pygame.display.set_caption("Labirinth")
    #filling background
    background = Surface((width, height))
    background.fill(Color(BACKGROUND_COLOR))

    #running the game
    running = True
    win = False
    while running:
        #clearing the screen
        screen.blit(background, (0, 0))

        #No direction chosen yet
        left, right, up, down = False, False, False, False 
        
        #checking events
        for event in pygame.event.get():
            #checking if the user tries to quit
            if event.type == QUIT:
                running = False
            #checking the direction
            if event.type == KEYDOWN and event.key == K_DOWN:
                down = True
            if event.type == KEYDOWN and event.key == K_UP:
                up = True
            if event.type == KEYDOWN and event.key == K_LEFT:
                left = True
            if event.type == KEYDOWN and event.key == K_RIGHT:
                right = True
                           
        #updating and drawing the labirinth and player's position
        cur_level.update(left, right, up, down)
        cur_level.draw(screen)
                           
        #updating the pixels of the screen
        pygame.display.update()

        #checking if the game is over
        if cur_level.finished():
            win = True
            running = False

    #closing the widnow and quitting the game
    pygame.quit()

    #returning True if the player has found the exit
    #and False otherwise
    return win
Esempio n. 7
0
import pygame, sys, os, urllib, cStringIO
from pygame.locals import *
from level import *
pygame.init()

pygame.display.set_caption('t9k Unofficial Collaborative Game')

mainScreen = pygame.display.set_mode((736, 480))
mainScreen = pygame.display.get_surface()
background = pygame.Surface((mainScreen.get_width(),mainScreen.get_height()))

keyBindings = {'paused': "k_P"}

states = []
states.append(level())
# states.append(<all of the menus>)
# I really don't understand how Python's memory management system works, so this will probably be
# an inefficient way to use memory.

pygame.display.flip()

size = mainScreen.get_size()
paused = False

currentState = states[0]

#	Changing states:
# Every level and menu will need to have a "state" variable, and a load() and unload() method
# When you change a state, the current state will unload, then the new state will load
#	Potential problems:
# Loading a level will require input data (which level, save files).