Re: [pygame] I can't seem to find any simple sprite animation game examples on the pygame.org site

2007-09-13 Thread Michael George
Ian Mallett wrote: That's why I put it in reverse order. I'm assuming you're replying to my comment. The algorithm is still wrong: i % j is 0 if i is a multiple of j, not if the last digit of i is j. Your scheme yields the wrong answer if the frame number is bigger than 10: def frame(i)

Re: [pygame] I can't seem to find any simple sprite animation game examples on the pygame.org site

2007-09-13 Thread Ian Mallett
> I'm assuming you're replying to my comment. Yes. Anyway, it was psudocode. You're probably right.

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Lamonte(Scheols/Demonic)
I'm sort of doing it a big differently, right now I'm just testing, but I can tell if my mouse position is in the second square block like so: elif event.type == pygame.MOUSEBUTTONDOWN: print pygame.mouse.get_pos() + (25,25) print MAP.blocks[

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Lamonte Harris
Whups major flaw forgot to check if the height also. On 9/13/07, Lamonte(Scheols/Demonic) <[EMAIL PROTECTED]> wrote: > > I'm sort of doing it a big differently, right now I'm just testing, but I > can tell if my mouse position is in the second square block like so: > > elif event.t

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Lamonte Harris
elif event.type == pygame.MOUSEBUTTONDOWN: print pygame.mouse.get_pos() + (25,25) print MAP.blocks[2].point mouse = pygame.mouse.get_pos() rng = mouse[0] - MAP.blocks[2].point[0] rng2

Re: [pygame] How do I make a image transparent?

2007-09-13 Thread Greg Ewing
Luke Paireepinart wrote: But this is per-pixel alpha, which is slower than colorkey transparency, I believe. In theory it may be, but I haven't found this to be a problem. As a benefit, you get better-looking results due to anti-aliasing of the edges (assuming your alpha channel has been create

Re: [pygame] How do I make a image transparent?

2007-09-13 Thread Greg Ewing
Ian Mallett wrote: I do it by filling in the transparent areas black, and using an option in psp6 (my paint program) to make those areas transparent. Then I save that to the alpha channel and save the file as a .png. So is that per-pixel? Technically, yes, but if it means there are no parti

Re: [pygame] I can't seem to find any simple sprite animation game examples on the pygame.org site

2007-09-13 Thread Greg Ewing
Ian Mallett wrote: if frame_number%10 == 0: #frame_number is a multiple of ten #draw frame 1 elif frame_number%9 == 0: #frame_number ends in 9 #draw frame 2 elif frame_number%9 == 0: #frame_number ends in 8 #draw frame 3 > ... Were there supposed to be different numbers in that? :-) Also

Re: [pygame] How do I make a image transparent?

2007-09-13 Thread Ethan Glasser-Camp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Greg Ewing wrote: > Luke Paireepinart wrote: >> But this is per-pixel alpha, which is slower than colorkey >> transparency, I believe. > > In theory it may be, but I haven't found this to be a > problem. As a benefit, you get better-looking results >

Re: [pygame] How do I make a image transparent?

2007-09-13 Thread Greg Ewing
Luke Paireepinart wrote: Yeah, I believe PNG's alpha channels are per-pixel. They are. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, | Carpe post meridiem! | Christchurch, New Zealand | (I'm not a morn

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Luke Paireepinart
Lamonte Harris wrote: elif event.type == pygame.MOUSEBUTTONDOWN: print pygame.mouse.get_pos() + (25,25) As DR0ID said, you should be able to get the mouse position from the event. print MAP.blocks[2].point mouse = pygam

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Greg Ewing
Lamonte Harris wrote: So I was thinking if I made an invisible rect that moved when the mouse moved then I left clicked and it would get the current surface position of the rect, then it would run a function to see if that current position matches any of the map squares at the bottom of the scr

[pygame] Just bought Python in a Nutshell

2007-09-13 Thread Lamonte Harris
http://www.powells.com/biblio/63-9780596001889-7 Used, has anyone read this book. Any additional information that you like,dislike about this book? [I like having real books and stead of ebooks because its better on the eyes.] Should be her 2morrow Afternoon :), few hours before I get home great

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Greg Ewing
Lamonte(Scheols/Demonic) wrote: elif event.type == pygame.MOUSEBUTTONDOWN: ... mouse = pygame.mouse.get_pos() It's better to get the mouse position from the event, seeing as you've got one, than to use mouse.get_pos(). Then you can be sure

Re: [pygame] Pygame Problem Solving 1

2007-09-13 Thread Greg Ewing
Lamonte Harris wrote: Whups major flaw forgot to check if the height also. Check out the collidepoint() method of the Rect class. It'll check both coordinates for you in one go. -- Greg Ewing, Computer Science Dept, +--+ University of Canterbury, |

Re: [SPAM: 6.000] Re: [pygame] How do I make a image transparent?

2007-09-13 Thread Greg Ewing
Ethan Glasser-Camp wrote: If there were a convert() function that changed fully-transparent alpha into a colorkey, I would use that; Probably you could just throw away the alpha channel and use the colour of the top left pixel as the colorkey. -- Greg Ewing, Computer Science Dept, +---

Re: [pygame] Just bought Python in a Nutshell

2007-09-13 Thread Kevin
I haven't read this book, but I'm usually wary of the "nutshell" type books or "learn some language in 7 days!" type books. Just make sure you check out the Tutorial on python.org because that is very thorough, and the book might just teach some neater things Python can do that you might not instan

Re: [SPAM: 6.000] Re: [pygame] How do I make a image transparent?

2007-09-13 Thread DR0ID
Hi Perhaps you should write a convert script that removes the alphachannel and replaces it with a colorkey of your choice. The main problem will be what do you do with half transparent pixels? e.g. pixel where the alpha value is between 0 and 255. From the set_alpha() documentation: "If the

Re: [SPAM: 6.000] Re: [pygame] How do I make a image transparent?

2007-09-13 Thread Ethan Glasser-Camp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 DR0ID wrote: > Perhaps you should write a convert script that removes the alphachannel > and replaces it with a colorkey of your choice. The main problem will be > what do you do with half transparent pixels? e.g. pixel where the alpha > value is betwe