Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Pygame Help?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Robocop413   Members   -  Reputation: 102

Like
0Likes
Like

Posted 05 May 2012 - 06:40 PM

Okay.. I am fairly new to pygame and I am having some serious issues. My goal is to create a game with an instruction screen that comes up upon game start and when the user clicks or pushes a button, it starts the game. Then when the user loses the game, it returns to the instruction screen.

How can I do this?

Here is what I have so far in this paste bin.

http://pastebin.com/cf5V4ExQ

The particular problem I am having is.. the turret which is in the bottom left hand corner.. is disfigured for what ever reason. When the user uses an arrow key, it is suppose to turn the turret. Also the program seems to be giving me this error.

line 77, in rotate
self.image = pygame.transform.rotate(self.image, self.dir)
error: Out of memory

no idea why this is happening. Someone please give me some guidance.. I hate being stumped. I was stumped on this for about 6 hours the other night.

here is also a picture, look at the turret in the bottom left hand corner. It seems really messed up :(

Attached Thumbnails

  • orbit_rider2.jpg


Sponsor:

#2 flodihn   Members   -  Reputation: 253

Like
1Likes
Like

Posted 06 May 2012 - 03:41 AM

Always rotate from the original image, otherwise the image will become distorted.
So this will not work:
self.image = pygame.transform.rotate(self.image, self.dir)



Try doing something like this instead:
self.image = pygame.transform.rotate(self.original_image, self.dir)
And make sure orignal_image is created once in the __init__ function and never transformed.

You seem to create one new image every time you rotate the turret, which might be the reason why you run out of memory.

Do you run out of memory at once or after some time?
Do you run out of memory if you never rotate the turret?

You also try using Heapy:
http://guppy-pe.sour...y_tutorial.html

Just play the game as usual and print out the heapy stats each frame and look what objects are growing in number. If the issue would be how you deal with images, heapy would probably show objects like PyGame.Image or Pygame.Sprite in increasing number.

Edited by flodihn, 06 May 2012 - 03:45 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS