Re: [pygame] Re: Delay Between iterations

2012-01-12 Thread Henrique Nakashima
Inside the while 1 loop, add a call to clock.tick(60). This will prevent the loop from running more than once every 1/60 second. On Thu, Jan 12, 2012 at 15:35, ANKUR AGGARWAL wrote: > In the last code provided I messed up the Bullet Class Code. Apologies for > that. Below is my code : > > import

Re: [pygame] gsoc: pygamedraw - status update

2010-06-17 Thread Henrique Nakashima
The module is looking very nice so far, I'm looking forward to using it =) Have you though about implementing the Pen class as an abstract class with the abc module? That would prevent Pen from being directly instantiated. On Thu, Jun 17, 2010 at 13:29, René Dudfield wrote: > sweet as :) >

Re: [pygame] online game?

2010-05-18 Thread Henrique Nakashima
Python has a low-level implementation of sockets natively. The specification and several examples can be found at: http://docs.python.org/library/socket.html On Tue, May 18, 2010 at 23:26, Alex Hall wrote: > Hi all, > Before I continue into the stra

Re: [pygame] Working with maps

2010-05-18 Thread Henrique Nakashima
That's a great idea, Timothy. I had no idea you could do pixel-by-pixel collision with sprites in Pygame. On Tue, May 18, 2010 at 05:02, Timothy Baldock wrote: > Hi Kenny, > > I'd do this by making each country a sprite with a transparent > background (colour-key transparency would work), then w

Re: [pygame] Working with maps

2010-05-17 Thread Henrique Nakashima
One simple idea would be to color each region a different color, and when a click is captured, check what color is at that position. This is limited however, as each region would have to have a unique color. On Tue, May 18, 2010 at 01:09, Kenny Meyer wrote: > Hey, > > I'd like to work with irre

Re: [pygame] informal poll on Windows python version

2010-04-28 Thread Henrique Nakashima
Windows Version: Windows XP Pygame Version: 1.9.1 Python Version: 2.6 On Wed, Apr 28, 2010 at 16:37, Stuart Axon > wrote: > Windows XP Home, + Windows Vista Home Premium > > Pygame 1.9.1 > Python 2.6 32bit > > On 28 April 2010 20:22, Luke Paireepinart wrote: > > Windows Version: Windows 7 Ult

Re: [pygame] DMs, what are you doing?!

2010-02-19 Thread Henrique Nakashima
The library I've been working on might be useful, if the project is a 2d tiled RPG: http://www.pygame.org/project-LibRPG-1293-2321.html I haven't worked on it for about two months, but the map part is working nicely, what is halfway done are me

Re: [pygame] "Merry Christmas - Christmas Avenger" flew under the radar - give it a chance

2010-02-17 Thread Henrique Nakashima
This is indeed a great game - simple to play, very fun and well designed =) On Sun, Feb 14, 2010 at 03:28, Nathan Franck wrote: > I'm the maker of the game, and I think it deserves a bit of merit. > It's a gift I gave last Christmas, and it just got swept under the > rug. Give it a chance! > > >

Re: [pygame] Help - Events

2009-11-17 Thread Henrique Nakashima
Oh, I see. In this case, I would use a variable 'held' to indicate the tile that is picked up. 'held' would be None if the no tile is held. When a mouse down event is received, if there is a piece in 'held' (held is not None), place it. If 'held' is None, then remove the tile at the mouse location

Re: [pygame] Help - Events

2009-11-17 Thread Henrique Nakashima
When you get a mouse button down event, store the mouse location. When you get a mouse button up event, check if the cursor location in the mouse up event is the same as the location in the last mouse button down event. If so, handle the removal. Else, handle the dragging. Hope this helps you. O

Re: [pygame] Fill a Rect object with color?

2009-11-07 Thread Henrique Nakashima
Yes, rects are only objects that delimit a rectangular area. Areas that can be drawn onto are Surfaces, and you could draw rectangles to those surfaces the ways Ian and RusselI mentioned. On Sat, Nov 7, 2009 at 16:34, Yanom Mobis wrote: > This is kind of embarrasing but I forgot how to fill a re

Re: [pygame] Limited Range?

2009-11-04 Thread Henrique Nakashima
This is the manhattan distance, which creates diamond shaped areas rather than circular shaped ones, for a given range. It is useful mainly for tile-based engines. If that is not the case, I think the euclidian distance (dx**2 + dy**2 <= r**2) will work much better. On Wed, Nov 4, 2009 at 15:23, K

Re: [pygame] Is my code messy?

2009-10-25 Thread Henrique Nakashima
It doesn't look bad to me. If you want to improve it, though, a few suggestions: - Break huge lines like towersGroup.add(Tower("donut.png", random.randint(100, (screen.get_width()-32)), random.randint(100, (screen.get_height()-32)),(random.randint(50,255),random.randint(50,255),random.randint(50

Re: [pygame] Seeing if this works...

2009-10-05 Thread Henrique Nakashima
When you blit a sprite to the screen, it is not erased from where it was previously blitted. You gotta do it manually, blitting the background over everything then the sprite in its new position. Alternatively, to avoid blitting the whole screen every loop, you can only blit the part of the backgr

Re: [pygame] Requiring pygame in setup.py

2009-10-05 Thread Henrique Nakashima
That explains it, I'm using distutils. I'll take a look at setuptools. Thank you for the replies =) On Mon, Oct 5, 2009 at 10:27, Marius Gedminas wrote: > On Sun, Oct 04, 2009 at 09:33:47PM -0300, Henrique Nakashima wrote: >> Hello, I'm working on my setup.py for a

[pygame] Requiring pygame in setup.py

2009-10-04 Thread Henrique Nakashima
Hello, I'm working on my setup.py for a Pygame library (http://www.pygame.org/project-LibRPG-1293-2260.html) and trying to declare Pygame 1.9.1 as a dependency. I wrote: setup(... provides=['librpg'], requires=['pygame(>=1.9.1)'], ... ) It worked, but

Re: [pygame] event getting corrupted

2009-09-16 Thread Henrique Nakashima
def _mouse_hit_widget(wid, hit_pos_x, hit_pos_y, draged_widget=None, dropreciever=False): Shouldn't there be a self as first parameter? On Wed, Sep 16, 2009 at 17:18, Bo Jangeborg wrote: > >> a ha >> Well, from where comes event ? > > event = pyg_event.poll() > > but note tha

Re: [pygame] Tilesets and Charsets

2009-08-24 Thread Henrique Nakashima
The Lorestrome Pixel Archive is indeed awesome, I will probably use some graphics from there. Reiner's Tilesets is good, but pretty much everything is for isometric graphics. The Nethack graphics are limited in terms of terrain/walls, but there is plenty of item images that might be useful. Look

[pygame] Tilesets and Charsets

2009-08-23 Thread Henrique Nakashima
Hello, I am writing a framework to develop tile based RPGs in Pygame. I need graphics for examples, the tutorial and the "standard graphics library" to be distributed with the framework, but I haven't been able to find material under a Creative Commons license, or in the public domain. Most of the

Re: [pygame] Another noob install question (PGU-0.12.3)...

2009-08-22 Thread Henrique Nakashima
I tried to find it, but in Google Code there were only .zips I just installed it in my Windows the way I described, so it should work =) On Sat, Aug 22, 2009 at 22:35, Yanom Mobis wrote: > i believe the simple install instructions were built for Linux/UNIX, > Windows has a binary pkg (I think)

Re: [pygame] Another noob install question (PGU-0.12.3)...

2009-08-22 Thread Henrique Nakashima
Extract the files to a folder anywhere. There is a setup.py file right at the root. Run "python setup.py install" and that will do the trick, installing the library to your C:\Python26\Lib\site-packages\ folder, or wherever python is installed. Since that folder is, by default, in the PYTHONPATH en

Re: [pygame] Surfaces with Transparent Backgrounds

2009-08-20 Thread Henrique Nakashima
Aha. There might be something weird about the image as well, because when I used another one with a transparent background it worked as well - without modifications to the code. Despite that, I couldn't find anything strange in the png. On Fri, Aug 21, 2009 at 00:23, pymike wrote: > Aha! Figure

Re: [pygame] Surfaces with Transparent Backgrounds

2009-08-20 Thread Henrique Nakashima
Transparency is often a problem because image editors and viewers not always display the same sorts of transparency. To create a transparent background, load it from an image with transparency. Png supports it, but not all png editors do. I managed to get transparency done by using GIMP (http://ww

Re: [pygame] Pygame Installation problems (Python 2.6.2)

2009-08-19 Thread Henrique Nakashima
Maybe you are trying to use a 64-bit python to run a 32-bit pygame? Since pygame has compiled .pyd files, that probably would not work. On Wed, Aug 19, 2009 at 18:51, Scott K. wrote: > Hey everyone, hopefully this email works. This is my first time using a > mailing list (crazy, I know). > > A

Re: [pygame] error code 193 on pygame import

2009-08-19 Thread Henrique Nakashima
If you're running Windows 64-bit, there's reports of this error: http://www.google.com/search?q=from+pygame.base+import+*+ImportError%3A+DLL+load+failed+with+error+code+193&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:pt-BR:official&client=firefox-a If that's the case, it was suggested to install a 32-

Re: [pygame] mouse.get_pos()?

2009-08-17 Thread Henrique Nakashima
import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((640, 480)) while 1: for event in pygame.event.get(): if event.type == KEYDOWN: exit() print pygame.mouse.get_pos() I just put together this code, it works fine here. Any differe

Re: [pygame] Re: sprite.spritecollide

2009-08-15 Thread Henrique Nakashima
If '[]' is the result of printing colliding_with, I'm pretty sure that is a list of only one instance of a Sprite. If it were the Sprite class itself if would be represented by '' or something like that, and would not contain the number of groups the sprite is in. That is also what the doc says: "

Re: [pygame] Re: sprite.spritecollide

2009-08-14 Thread Henrique Nakashima
You could identify your sprites with a unique id, then take the list returned by pygame.sprite.spritecollide and check which of them is in there, which will be the one that collided. On Fri, Aug 14, 2009 at 22:40, Maxwell Wise wrote: > Ok, say I have 8 instances of a class called Tableau, which

Re: [pygame] Scrolling

2009-08-03 Thread Henrique Nakashima
Mine is based on tiles, but I don't see why it is easier with them. On Mon, Aug 3, 2009 at 15:53, James Paige wrote: > Is your scrolling map based on tiles? > > if so, this problem gets easier... > > --- > James Paige > > On Mon, Aug 03, 2009 at 11:30:25AM -0700, Yanom Mobis wrote: > >well i

Re: [pygame] Scrolling

2009-08-03 Thread Henrique Nakashima
I am using this sort of scrolling, blitting the part of the background that appears on the screen, then the objects, but the updates are a bit truncated. I've profiled the game and there is no processing bottleneck as far as I analysed. After doing some research, I found that this truncation could

Re: [pygame] Axelay-like background scroll getting operand error

2009-07-21 Thread Henrique Nakashima
In Python, exponentiation can be done with the ** operand (2 ** 3 returns 8). I don't know whether that is different in any way from pow(2, 3), but help(pow) says it's the same. On Tue, Jul 21, 2009 at 11:59, Paulo Silva wrote: > http://pastebin.com/f5b433a3e > thank you! :) > > On 7/21/09, Zack

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-13 Thread Henrique Nakashima
Traceback (most recent call last): File "col.py", line 52, in collide=pygame.sprite.collide_rect(sprid[0],sprid[1]) File "C:\Python25\lib\site-packages\pygame\sprite.py", line 1146, in collide_r ect return left.rect.colliderect(right.rect) AttributeError: 'pygame.Surface' object has no

Re: [pygame] sprite collisions - looking for simple snippet

2009-07-12 Thread Henrique Nakashima
Pygame.sprite has methods for detection collisions: pygame.sprite.spritecollide(), pygame.sprite.collide_rect(), etc. You can find their reference at http://www.pygame.org/docs/ref/sprite.html. On Sun, Jul 12, 2009 at 17:41, wrote: > hi! > i'm having difficulty on coding a small nippet of sprit