1 Replies - 241 Views - Last Post: 27 October 2013 - 09:58 AM Rate Topic: -----

#1 avi312singh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-October 13

Screen blit being weird and jump feature-code/screenshots given-pygame

Posted 26 October 2013 - 01:10 PM

I'm currently making a game with pygame. I have two issues with my game at the moment.
1.
My jump isn't working - the player should have the ability to jump by pressing up when there is a collision detection between player and platform (then player.rect.y-=40) I have tried solve this in many ways. For example, see line 179 (at if event.type == pygame.KEYDOWN:).

2.
Also the scrolling of the screen is fine, but once the image has been scrolled completely after its second time (it works fine first time) the screen blit goes all weird, all the sprites in the game leaves massive trails behind where it was previously (check screnshots). Maybe pygame.display.update() might not be working correctly? (probably not though)


I have been trying to fix these two problem for ages (yr.13 A level coursework), and I really need to get moving with other features I need to do, so any help is greatly appreciated. The collide does work correctly because gravity (line 130) works fine:

http://pastebin.com/ub6gi8Zn - game code...

http://gyazo.com/d9f...9d66fd497323bb8 -- Blit working fine before background has repeated itself twice SCREENSHOT

http://gyazo.com/aa5...9ce2ec42c9ba501 -- after the background repeating itself twice

Thanks for help

Is This A Good Question/Topic? 0
  • +

Replies To: Screen blit being weird and jump feature-code/screenshots given-pygame

#2 witeboy724  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 29
  • Joined: 21-June 12

Re: Screen blit being weird and jump feature-code/screenshots given-pygame

Posted 27 October 2013 - 09:58 AM

Pastebin link is down so I can't see your code.

You might want to check the order that your are blitting things on the screen. You'll need to redraw the background in spots where an object moved at least. Some people do this using dirty rects. I learned a lot from this guide:

http://www.pygame.or...ewbieguide.html

Sense you said things are getting weird the 2nd time around, make sure you aren't creating any duplicate objects or rect locations. I'll take a look if you post your code.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1