Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- from pygame import *
- import sys
- import random
- import time
- #things to do!
- #Add decent graphics
- #Add a level system
- #Add decent move system
- #Game window including game loop
- #################################
- class game:
- pygame.display.update()
- pygame.time.Clock(60):
- gameloop = True
- def game():
- while(Gameloop == True):
- pygame.init()
- window = pygame.display.set_mode((800,600))
- pygame.display.set_caption("Game")
- #Font including Quit & Start options
- ######################################
- class font:
- pygame.font.init()
- text = pygame.font.Font.render("To quit Press <Q> To start Press <S>", 255.255.255)
- pygame.blit(text, (400,300))
- pygame.display.update()
- for keys in pygame.event.get():
- if(keys == pygame.key.Q):
- sys.exit()
- pygame.quit()
- elif(keys == pygame.event.QUIT()):
- sys.exit()
- pygame.quit()
- elif(keys == pygame.key.S):
- #Game
- #Player movement
- ######################################
- class move:
- xx = 10
- yy = 0
- move1 = True
- for move in pygame.event.get()
- while(move1 == True):
- #checken of de coords juist zijn
- if(move == pygame.key.KEYUP):
- yy += 10
- xx += 0
- pygame.blit(player.player1, (yy, xx))
- pygame.display.update(player.player1)
- elif(move == pygame.key.KEYDOWN):
- xx -= 0
- yy -= 10
- pygame.blit(player.player1, (yy, xx))
- pygame.display.update(player.player1)
- elif(move == pygame.key.LEFT):
- xx -= 10
- yy -= 0
- pygame.blit(player.player1, (yy, xx))
- pygame.display.update(player.player1)
- elif(move == pygame.key.RIGHT):
- xx += 10
- yy += 0
- pygame.blit(player.player1, (yy, xx))
- pygame.display.update(player.player1)
- #Player,
- ###############################
- class player:
- width1 = 4
- height1 = 5
- player1 = pygame.draw.circle(window, 255.255.255, width1, height1)
- if(player1 == pygame.draw.circle(window, 255.255.255, width1,height1)):
- pygame.display.update(player1)
- #Score
- ######################################
- class score:
- score = 0 #Hier nog op terug komen i.v.b met players
- pygame.font.init()
- for keykes in pygame.event.get():
- if(keykes == pygame.key.S):
- pygame.font.Font.render("Score:" + score, 255.255.255)
- elif(keykes == pygame.key.Q):
- pygame.display.quit()
- sys.exit()
- #Life system including death message
- ####################################
- class life:
- life = 3
- if(life == 0)
- pygame.font.init()
- death1 = pygame.font.Font.render("You Lost you fool!", 255.0.0)
- pygame.blit(death1, (400,300))
- pygame.display.update(death1)
- time.sleep(3)
- pygame.display.quit()
- sys.exit()
- move.move1 = False
- game.Gameloop = False
- elif(enemy.circle.contains(player.player1) and width1 > width and height1 > height and life != 0):
- move.move1 = False
- pygame.blit(death, (400,300))
- pygame.display.update(death)
- for k in pygame.event.get():
- if(k == pygame.key.S):
- life -= 1
- game.game()
- elif(k == pygame.key.Q):
- pygame.display.quit()
- sys.exit()
- game.Gameloop = False
- #Enemy / point system
- ###############################
- class enemy:
- width = 3
- height = 5
- move = True
- circle = pygame.draw.circle(window, 255.0.0, width, height)
- if(circle):
- while(move == True):
- xx = random.randint(1,800)
- yy = random.randint(1,600) #eventueel aanpassen
- pygame.blit(circle, (xx, yy))
- pygame.display.update(circle)
- if(circle.contains(player1) and player.width1 < width and player.height1 < height or circle.colide(player1)) and player.width1 < width and player.height1 < height):
- circle.copy()
- pygame.blit(circle, (700,500))
- score.score += 10
- player.width1 += 5
- player.height += 5
- elif(circle.contains(player1) and player.width1 > width and player.height1 > height or circle.colide(player1)) and player.width1 > width and player.height1 > height):
- life.life != 1
- if(life.life == 0):
- move = False
- time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement