#Need help with my first attempt at a 2d game

2 messages · Page 1 of 1 (latest)

crimson belfry
#

basically I've been on and off coding for a while and i recently got into it again. I'm trying to make a 2d mining game. Currently I'm working on the background, mainly just trying to make different colored blocks appear. currently i get no errors but for some reason its not showing me the window with all the blocks as it has done in the past.


import pygame
import random
from pygame.locals import *
pygame.init()
import sys
sys.setrecursionlimit(100000)

SCR_WID, SCR_HEI = 640, 480
        dirtx + 1
        return



#100- 470
def dirty():
    while dirty() < 470:
        dirty + 1
        return


def fill_background():
    if 0 == 0:
        screen.fill(GRAY)
          

def COLOR1():
    random.randint(0, 255)


def COLOR2():
    random.randint(0, 255)


def COLOR3():
    random.randint(0, 255)


                

#mining game
#goal- reach the core
#feature- inventory, upgrades, shop, enemies?





SCR_WID, SCR_HEI = 640, 480
screen = pygame.display.set_mode((SCR_WID, SCR_HEI))
pygame.font.init()
GRAY = (128, 128, 128)
RED = (255, 0, 0)

COLOR1 = random.randint(0, 255)
COLOR2 = random.randint(0, 255)
COLOR3 = random.randint(0, 255)






dirt = dirt()
dirtx = 1
dirty = 100


def main():
        while True:
                #process
                for event in pygame.event.get():
                                if event.type == pygame.QUIT:
                                        print ("Game exited by user")
                                        exit()
               
                fill_background()
                
                dirt.__init__()

                dirt.draw()

                pygame.display.flip()

main()```
gentle trout