The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

C++, Degrees and Space Mines by really-joel2007-08-08 07:24:21
  Look up the Unit Circle by sazzer2007-08-08 07:39:59
    If I understood correctly.. by really-joel 2007-08-08 07:59:20
then the code would look something like this:
void Bullet::Update(float aTime)
{
  float DeltaX = 0;
  float DeltaY = 0;

  DeltaX = mSpeed * cos((double)mDegree);
  DeltaY = mSpeed * sin((double)mDegree);

  mPosX += (DeltaX * aTime)/2;
  mPosY += (DeltaY * aTime)/2;
}
And it kinda does something like what I want, only different degrees yield completely different results.. I havn't figured out the system to it yet, but it's seemingly almost completely random what direction the bullet goes.. =)
[ Reply ]
      I'll point out that by sgrunt2007-08-08 08:09:49
        It does! by really-joel2007-08-08 08:13:04
          Aha: by sgrunt2007-08-08 08:13:59
            Wehoo by really-joel2007-08-08 08:21:01
          degrees vs rads by ExO_DsR2007-08-08 08:18:04
      C++ nitpick by Michiel2007-08-08 08:18:48
        =) by really-joel2007-08-08 08:22:15
        Also by Orky2007-08-09 07:22:59
          I misinterpreted by really-joel2007-08-12 06:55:33

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)