Hello all!
I am a beginner programmer, and I have been told that a great first project would be to make an ASCII game, I have done all of the coding (I think) and I'm still having some problems (i.e. it won't work, at all), I believe it's the render. Any help would be appreciated.
import pygame
class RenderWindow:
def __init__(self, x , y):
self.width = x
self.height = y
self.font = pygame.font.Font("fonts/font.ttf, 10")
self.twidth, self.thight =self.font.size(" ")
self.screen = pygame.surface((x*self.twidth, y*self.thight))
self.memory = []
self.set_up_screen(x, y)
def set_up_screen(self, x, y):
for y in xrange(y):
for x in xrange(x):
self.memory[y][x] = [(0, 0, 0), (0, 0, 0), " "]
def draw_tile(self, x, y):
obj = self.memory[y][x]
forground = obj[0]
background = obj[1]
letter = obj[2]
surface = self.font.render(letter, False, foreground, background)
self.screen.blit(surface, (x*self.twidth, y*thight))
def draw(self):
for y in xrange(self.hight):
for x in xrange(self.width):
self.draw_tile(x, y)
def set_tile(self, x, y, desc):
self.memory[y][x] = desc()
I know it isn't very good.
Again, Thanks for any help.
lucksoar