C++; X offset towards angle in grid

GooS

Azrael
Reaction score
154
I'm making a game and I need the character to move x points towards an angle, but I suck at math so I need some help,
this image should explain my problem:

attachment.php


No need to make any snippets or such, just a push in the right direction.

Thx, //==GooS

offset.jpg
 

Vestras

Retired
Reaction score
248
I'd suppose it was like WC3:
Code:
int newX = x + distance * Cos(angle);
int newY = y + distance * Sin(angle);

I suck at math though.
 

GooS

Azrael
Reaction score
154
Damn, after so many times using it in WE and it still failed to come to my mind.

Thx lots vestras ;) It works grand!

//==GooS
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top