Page 1 of 1

Real bearing

PostPosted: Sun Mar 27, 2011 3:50 pm
by FERdeBOER
Hi to all,

I would like to put a real bearing indicator for the game I'm creating, but I find that GE has a 360º diverse from the "real", where 0 is North, 270 West, 180 South, 90, East.
So I've created a text actor and, in draw actor put:
Code: Select all
bearing.textNumber = round(player.angle);

But the angles it shows is the GE ones: East 0º, North 90º...

How can I fix this?

Thank you.

Re: Real bearing

PostPosted: Sun Mar 27, 2011 5:03 pm
by schnellboot
Code: Select all
switch (player.angle)
{
case 0: bearing.textNumber=90;
break;
case 90: bearing.textNumber=0;
break;
case 180: bearing.textNumber=270;
break;
case 270: bearing.textNumber=180;
break;
}


I dunno if this is what you want ..

Re: Real bearing

PostPosted: Sun Mar 27, 2011 5:42 pm
by FERdeBOER
Thank you for your answer.

I don't know what and where to put your code, but seems to be for "exact" situations for 90º show 0º... but I want to change it in all directions so, when the player is facing 190º (GE degrees) it shows 260º (true bearing).

Re: Real bearing

PostPosted: Sun Mar 27, 2011 7:07 pm
by schnellboot
Okay so for all angles use this:
Code: Select all
if(player.angle<=90)
{
    bearing.textNumber=player.angle+90-player.angle*2;
}
else if(player.angle<=180)
{
    bearing.textNumber=player.angle+270-(player.angle-90)*2;
}
else if(player.angle<=270)
{
    bearing.textNumber=player.angle+90-(player.angle-180)*2;
}
else if(player.angle<=360)
{
    bearing.textNumber=player.angle-90-(player.angle-270)*2;
}


ok put this in draw actor instead of
Code: Select all
bearing.textNumber = round(player.angle);


maybe there is an easier way, but this is my way.
I tried many times to fix this code so it should be perfect now.
If you find bugs, report them to me.

Re: Real bearing

PostPosted: Sun Mar 27, 2011 8:51 pm
by FERdeBOER
Thank you very much!

That's what I looked for. :mrgreen:

Re: Real bearing

PostPosted: Sun Mar 27, 2011 8:54 pm
by schnellboot
you're welcome