Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Algorithms > Bullets!
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 666 of 670
Post > Topic >>

Bullets!

by "CMulvey" <devnull@[EMAIL PROTECTED] > Mar 23, 2008 at 09:30 PM

Hi All,

This might sound like a very elementary question, i've been working on a
small personal project making a top down shooting game where the player
controls a character(sprite) using the mouse, the player's character
should
be able to shoot from its current location, in a straight line in at the
cursor.

The problem i'm having is that I can't seem to get the player's character
to
shoot anywhere near the cursor and also, it won't shoot at a constant
speed,
i've tried a couple of different approaches which each seemed to end in
disaster. Most of the time the character can move around and do what hes
told but when the character is instructed to shoot the bullets fly off in
any direction apart from the one hes supposed to be aiming at, and at
random
speeds.

So basicly what i'm looking for is a little short algorythym to calculate
the coordinates for each frame when a bullet is shot from the position of
the players character e.g: coordinates 50,50 to where ever the cursor is
aiming e.g (200,250) at a constant speed. The bullet terminates and is
destroyed when it reaches the boundarys of the screen(already have this
done).

I've virtually everything else working except this. The program is laid
out
in a simple enough manner with the following functions(amongst others).

UpdateSprites()
Update the position of all the sprites on screen whenever anything moves

CheckCollide()
Check whether a bullet has hit another player/enemy/tree/game boundaries.

UpdateScreen()
When all sprite drawings/updates are done, redraw the screen.


I'm working under WinXP and using C/C++ under VS2k3. I decided to go
against
the 3D glitsy approach and am using GDI.

-

Con




 3 Posts in Topic:
Bullets!
"CMulvey" <d  2008-03-23 21:30:04 
Re: Bullets!
Miss Elaine Eos <Misc@  2008-03-24 02:05:19 
Re: Bullets!
IsaacKuo <mechdan@[EMA  2008-04-01 13:01:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 18:38:54 CDT 2008.