Hi there,
I've left the board game for a time, and now that I have time again,
I have returned to it..
Can I do new=pygame.rect(10,20,30,40) ? I mean, I do load an entire
image of my game board, that will be the surface, and then, as
Samuel said, I've tried to create invisible squares over it using
rect function, but, do I need to load an image -many as squares have
my board- , make it invisible and take the rect from it?
Thanks again..I think some doy I'll finish it (0_o)
El 18/09/2007, a las 17:20, Samuel Mankins escribió:
Ian Mallett wrote:
It doesn't really matter which way you do it, but I would
recommend making the entire thing all at once, as I see no advantage
to having individual squares, and it would make programming less
complicated.
Ian
I would make a square of the appropriate size of one color, and
load it using this function:
def load_image(name):
fullname = os.path.join('images')
fullname = os.path.join(fullname, name)
try:
image = pygame.image.load(fullname)
except pygame.error, message:
print 'Cannot load image:', fullname
raise SystemExit, message
image = image.convert()
colorkey = image.get_at((0,0))
image.set_colorkey(colorkey, RLEACCEL)
return image, image.get_rect()
Then use it for all the squares, and define their coordinates by
pixel. The result is a whole bunch of little, invisible squares,
each one having a question attached to it, that the player can
click on, and behind that a background image that doesn't change.
This might be more trouble than it's worth for the sort of thing
you're aiming for--I used it when building a small RPG where the
background was a complete image for each area and the blocks were
defined as being either "Player can't walk here", "Player can walk
here", or "Player meets monsters here", so that (if I could
actually draw on a computer) each area would have a pretty background.
Anyway, I hope that helps. God luck!