flying spaceship, math=hard

This is a discussion on flying spaceship, math=hard within the Game Programming forums, part of the General Programming Boards category; First let me say I SUCK WITH MATH and am using mingw32 with allegro. Im making this space melee fighting ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    133

    flying spaceship, math=hard

    First let me say I SUCK WITH MATH and am using mingw32 with allegro.

    Im making this space melee fighting game where two ships fight, when you press right or left it rotates to the right or left, I can do this pretty easily because I just use rotate_sprite but the problem is when I want to accelerate, how do I make it so the ship moves the proper amount of X, Y spaces depending on the angle. btw allegro does degrees weird, 256 is like 360, so 64 would be like 90, 32 like 45, etc...
    flashdaddee.com rocks!!!

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Trigonometry

    NewXpos = OldXpos + SpeedPerFrame * cos(Angle * PI / 128);
    NewYpos = OldYpos + SpeedPerFrame * sin(Angle * PI / 128);

    If 'Angle' is expressed in your "256-degrees" system
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    133
    gracias
    flashdaddee.com rocks!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2D Spaceship shooter online - Need 2 keen programmers
    By drallstars in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 05-19-2005, 07:40 AM
  2. OpenGL Spaceship
    By Necrofear in forum Game Programming
    Replies: 11
    Last Post: 03-14-2005, 02:43 PM
  3. Private Spaceship.
    By adrianxw in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 06-22-2004, 11:29 AM
  4. Everyone look at my totally sweet spaceship
    By Shadow12345 in forum Game Programming
    Replies: 4
    Last Post: 09-30-2002, 02:27 PM
  5. Flying away....!
    By Betazep in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-18-2002, 12:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21