[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] question about Rect objects
- To: pygame-users@xxxxxxxx
- Subject: [pygame] question about Rect objects
- From: Alex Hall <mehgcap@xxxxxxxxx>
- Date: Tue, 18 May 2010 00:24:15 -0400
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 18 May 2010 00:24:38 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=oNaJmBxuuWjBnnyOVL+scX/l7ZEq6C/Somc79YB/1OA=; b=kbiIfSu/nV5hg079bl+/6pewwsbB9eQ0Igfl0HqhnQXAQzrNqbU/NcfYt/rydUQXMb ht40xUxyH9jneC1e9CEd6CLTxmlEXlxPQY6tEhxG/XIkx+1bqD1b1qHeZtSIAnaSqJjx l/xMvNMok+QpN8U3QOq/X8wXdEsejAzoglRdA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=aN7sAweTseJtuFX+MV1s3StvF51zMy1pNja5DUyjGVAKj5yBgmqUZgSDuBvG6IN31D BPwEavRB3YyoyTtk2hWmxXslwLhq9m8aW4X+SR36F05mrYAxg+7ilsnbdo8hlIbOH0X+ xuhrx1RlT0n53pAl3fjEMK+nV0VSGelBsp8cY=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi all,
I am new to this list. A quick intro:
I am a blind college student studying for a computer science degree. I
use Jaws for Windows from Freedom Scientific to read the content of my
computer screen. I have a bit of vision, enough to see high-contrast
colors in a big enough window (500x500 or larger is good).
I use Python2.6 with the latest release of Pygame. I am trying to add
a visual element to a Battleship game I wrote last year. Originally,
the game was all based on screen readers; the user could arrow around
and their screen reader (the program that reads text on the computer)
would announce which square they were on and the status of that
square, among other information. No visuals were needed since most
screen readers offer an API which I can interface with directly.
However, I want to expand this to a 2-player, online game so my
sighted friend and I can play against each other. Of course, for that,
I need to give him something to look at.
I am trying to generate a grid of rectangles, each rect a square on
the classic Battleship grid. All rects will start out gray, and will
then change color as the game progresses (red=hit, white=miss,
blue=enemy sighted). I have a Square class, which has variables like
firedOn or ship. That way I can examine the square on which the user
fired, change its firedOn from False to True, and say something like
"if(grid[i][j].ship!=None): #change color to red". You get the idea.
Anyway, the pygame documentation says rect cannot be subclassed. Is
there any way, then, for me to put a rect object in my Square class,
then draw the grid using my grid (a 2d array of Squares)? I guess what
I want is to say:
bg.replace_ip(red, grid[i][j].rect) #change fired-on grid square to
red and redraw it
after building my grid of rects? I am quite new to Pygame, and this is
my first time venturing into the world of generating shapes and grids;
up to now, my involvement in visual elements has been some
experimenting with wxPython and XRC, and that package does most of the
layout for you. Any help with this grid problem would be greatly
appreciated, and please tell me if my above question and explanation
do not make sense (as I doubt they will).
--
Have a great day,
Alex (msg sent from GMail website)
mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap