Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am programming a 2D sidescroller in python and pygame and am having trouble making a bullet go farther than just farther than the player. The bullet travels straight to the ground after i fire it. How, in python code using pygame do I make the bullet go farther. If you need code, here is the method that handles the bullet firing:

    self.xv += math.sin(math.radians(self.angle)) * self.attrs['speed']
    self.yv += math.cos(math.radians(self.angle)) * self.attrs['speed']
    self.rect.left += self.xv
    self.rect.top += self.yv
share|improve this question
    
This is way too vague, you should post some snippets of code (not the whole program). –  Lohoris Mar 30 '12 at 15:56

2 Answers 2

It's unclear what happens to the bullet.

Does it have the same speed as the player? In that case, obviously the bullet should have a greater speed.

Does it disappears just after it appeared? Maybe you misplaced it and collided with the player.

share|improve this answer

There is a 2D physics engine that integrates nicely with PyGame. It is called PyMunk and uses the Chipmunk 2D physics engine. You might want to use it if you do something more with physics in your games.

share|improve this answer
    
This does not appear to really address the asker's issue. –  Josh Petrie Jan 9 at 4:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.