Friday, 15 March 2013

python - Randomly blitting in Pygame -


im creating a basic pygame and I was wondering if anyone can help me

then a After definite

  def random_event (self): The amount of time a power-up scroll down the screen but I can not get it to work  

here's the method Im using myself Force_img_r = self.force_img.get_bounding_rect () self.rnd_x = random.randint (5315) self.force_img_r.x = self.rnd_x self.force_img_r.y + = 3 screen.blit (self.force_img, (self.rnd_x, self .force_img_r.y))

All your tax image is blinking for a split second, nothing is anything

This is the reason why anyone can tell me That its not working !?

After

In pygame you usually have a main loop that the screen on every trip is clear, that maybe So you take a nap to see only one, you attract and clean you again in the next loop.

To work on it, only the game position should be updated in the Pigam incidents, and the draw on the screen should be present on each loop.

Some pseudocode:

  # main loop when corrected # action event # - & gt; Game status # Clean screen # Draw the current position on the screen # Update or flip display # Keep the framerate (tick clock)   

You can call external classes / methods / functions , But you should always put this structure on the main loop.

No comments:

Post a Comment