0

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.

4
Contributors
4
Replies
9
Views
6 Years
Discussion Span
Last Post by eskimo456
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.

0

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.

Edited by savalia: n/a

0

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

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.