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-joel 2007-08-08 07:24:21
I'm making a 2D space shooter in C++, and have now run into a math problem. I'm sure it's easy, but I'm not very good at math.. =(

Here's the problem, I have a class Bullet(float x, float y, int degree) that other classes create. From the passed position and degree, it should start doing its thing (which is basically just travel along..)

But how do I use theese values? I'm pretty certain I should use sin/cos/tan, but I don't know how. I need a value that could be both positive and negative, and I guess it should be 0 at every 180 degrees so that for example a degree of 0 (up) doesn't affect the algorithm for X, only Y.

Any help is apriciated.
[ Reply ]
  High school math by Orky2007-08-08 07:32:17
    Re by really-joel2007-08-08 07:41:24
    Orky, that first line was unnecessary. (n/t) by kelli2172007-08-08 07:53:21
      Agreed... by jdelphiki2007-08-08 09:26:47
      But it sounded funny! by Orky2007-08-09 07:24:13
    "An angle", combined with magnitude, is a vector. by Phoon2007-08-08 09:25:49
  Look up the Unit Circle by sazzer2007-08-08 07:39:59
    If I understood correctly.. by really-joel2007-08-08 07:59:20
      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
  It's simple in theory.... by Didactylos2007-08-08 07:42:08

 

[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.)