Sign in to follow this  
phil67rpg

bullets an d tanks

Recommended Posts

I am trying to get a tank sprite to shoot a bullet if (KEY_DOWN(VK_SPACE)) {//move the sprite // for (int i=0;i<=2;i++) // { bullet.x = bullet.x + 5; bullet.y = bullet.y + 0; // } //set up the filename // sprintf(s,"bullet.bmp"); //load texture with "pink" as the transparent color // bullet_image[0] = LoadTexture(s, D3DCOLOR_XRGB(255,0,255)); let me know is you need more code }

Share this post


Link to post
Share on other sites
I reckon you need more code.

Seriously, your problems right now appear to lie elsewhere. Start with drawing the bullet each frame. Then draw the bullet at y=0, z=0, x=sin(t) where t is the current time. Then draw the bullet at the position described by the fields of a {float x,y,z;} struct. Then have the bullet moved to the tank when fired and fly off towards +Y. Then have the bullet fly off in the direction the tank is facing.

Doing this iterative work might help teach you how to design it better.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this