954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pygame Bullet

So I'm pretty far into development of my new game and I am trying to figure out how to do a bullet that will look like it fires from a plane sprite I thought of a way it didn't work so I went back to my old code. I would appreciate if someone could help code a bullet.

I'll post my code only if asked for it.

Gh0st93
Newbie Poster
12 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

Are you interested in the physics or its visual appreance? For the physics part, you can simply model the bulets by a vector that travels straight in its direction. But i'm not completely sure what exactly you need.

firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
 

Are you having trouble with the bullet's trajectory or with its starting point? If its the trajectory (bullet path) don't forget to include the plane's direction/velocity/acceleration into the equation. If your problem is the bullet start point, make sure the bullet starts outside the collision detection spehere of your plane object.

savalia
Newbie Poster
2 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

you see the plane does not have any of that because its position is based on where the player moves the mouse.

Gh0st93
Newbie Poster
12 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

You should know where the plane sprite is in space through the translations that have occurred. If you generate the bullet at the planes co-ordinates and then move it to the specified place to shoot from (i'm assuming the wing).

If the plane sprite is a 1X1 square for example assuming the middle of the plane is the (0,0) position. you could do something like.

bulletX = planeX - 0.5;
bulletY = planeY + 0.3;

That would be the start co-ordinate then just increase y axis (assuming your game is 2D) to have it travel forward.

eskimo456
Junior Poster in Training
54 posts since Dec 2010
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: