Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Pygame Development 1
- # Start the basic game set up
- # Set up the display
- # Call the pygame library
- import pygame
- # screen properties
- SCREEN_TITLE = 'Crossy RPG'
- SCREEN_WIDTH = 800
- SCREEN_HEIGHT = 800
- WHITE_COLOR = (255, 255, 255)
- BLACK_COLOR = (0, 0, 0)
- clock = pygame.time.Clock()
- class Game:
- TICK_RATE = 60
- def __init__(self, title, width, height):
- self.title = title
- self.width = width
- self.height = height
- game_screen = pygame.display.set_mode((width, height))
- game_screen.fill(WHITE_COLOR)
- pygame.display.set_caption(title)
- def run_game_loop(self):
- is_game_over = False
- while not is_game_over:
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- is_game_over = True
- print(event)
- # pygame.draw.rect(game_screen, BLACK_COLOR, [350, 350, 100, 100])
- # pygame.draw.circle(game_screen, BLACK_COLOR, (400, 300), 50)
- # game_screen.blit(player_image, (375, 375))
- pygame.display.update()
- clock.tick(self.TICK_RATE)
- class GameObject:
- def __init__(self, image_path, x, y, width, height):
- object_image = pygame.image.load(image_path)
- self.image = pygame.transform.scale(object_image, (width, height))
- self.x_pos = x
- self.y_pos = y
- # initialize pygame
- pygame.init()
- new_game = Game(SCREEN_TITLE, SCREEN_WIDTH, SCREEN_HEIGHT)
- new_game.run_game_loop()
- # player_image = pygame.image.load('images/player.png')
- # player_image = pygame.transform.scale(player_image, (50, 50))
- pygame.quit()
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement