Skip to content

Instantly share code, notes, and snippets.

@Insood
Created Aug 10, 2017
Embed
What would you like to do?
import pygame
import random
bg_color = (255,255,255)
clock = pygame.time.Clock()
card = pygame.image.load("card.jpg")
card_size = card.get_rect()
running = True
screen_size = (int(card_size.w)*2, int(card_size.h)*2 )
screen = pygame.display.set_mode( screen_size )
while running:
clock.tick()
#tick_time = clock.get_time()
#total_time += tick_time
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
offsets = [ (0,0), (card_size.w,0), (0,card_size.h), (card_size.w,card_size.h)]
screen.blit(card, offsets[0])
screen.blit(card, offsets[1])
screen.blit(card, offsets[2])
screen.blit(card, offsets[3])
number_x_offset = 23
number_y_offset = 43
number_height = 55
number_width = 55
color = [255,0,0,128]
for card_index in range(0,4):
for x in range(0,5):
for y in range(0,5):
r = random.randint(0,100)
if (r % 50) == 0:
blit_x = offsets[card_index][0] + number_x_offset + number_width*x
blit_y = offsets[card_index][1] + number_y_offset + number_height*y
pygame.draw.rect(screen, color, (blit_x, blit_y, number_width, number_height))
pygame.display.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment