• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualBrother Bob

Posted 22 July 2013 - 12:07 PM

Alright, this will be a bit more involved.  I've worked on a couple of different ways to do this over the years but sometimes these things can become overly complicated when you start running into oddities that require extra code to deal with all the weird errors that pop up when angles switch from 0 to 360 or when things switch from positive to negative so to start off with let's try just roughing out the proper angle for a given direction.

So to start off, let's just define an angle that is attached to a particular direction, this will cause the ship to snap instantly to the proper rotation but we can work on how to make it a smooth transition afterwards.

For UP,   the angle is 0.0

For LEFT,   the angle is 90.0

For DOWN, the angle is 180.0

For RIGHT,  the angle is 270.0

//=================================================================

ship_down_two() { ship_01_POSITION_Y -= 0.1;

ship_01_ROTATION   = 180.0; }

//=================================================================

### #3marcClintDion

Posted 22 July 2013 - 03:08 AM

There is far too much arrogance and out right abuse by site moderators, they are teaching other people to behave this way.  The posts I've made will all be shorty removed and replaced with this notice.  Game development is not the only thing being taught here, bad behavior is being taught as well.

### #2marcClintDion

Posted 01 July 2013 - 06:30 PM

Alright, this will be a bit more involved.  I've worked on a couple of different ways to do this over the years but sometimes these things can become overly complicated when you start running into oddities that require extra code to deal with all the weird errors that pop up when angles switch from 0 to 360 or when things switch from positive to negative so to start off with let's try just roughing out the proper angle for a given direction.

So to start off, let's just define an angle that is attached to a particular direction, this will cause the ship to snap instantly to the proper rotation but we can work on how to make it a smooth transition afterwards.

For UP,        the angle is     0.0

For LEFT,    the angle is   90.0

For DOWN, the angle is 180.0

For RIGHT,  the angle is 270.0

//=================================================================

ship_down_two()
{
ship_01_POSITION_Y -=     0.1;

ship_01_ROTATION      = 180.0;
}

//=================================================================

### #1marcClintDion

Posted 01 July 2013 - 06:29 PM

Alright, this will be a bit more involved.  I've worked on a couple of different ways to do this over the years but sometimes these things can become overly complicated when you start running into oddities that require extra code to deal with all the weird errors that pop up when angles switch from 0 to 360 or when things switch from positive to negative so to start off with let's try just roughing out the proper angle for a given direction.

So to start off, let's just define an angle that is attached to a particular direction, this will cause the ship to snap instantly to the proper rotation but we can work on how to make it a smooth transition afterwards.

For UP,        the angle is     0.0

For LEFT,    the angle is   90.0

For DOWN, the angle is 180.0

For RIGHT,  the angle is 270.0

//=================================================================

ship_down_two()
{
ship_01_POSITION_Y -=     0.1;

ship_01_ROTATION      = 180.0;
}

//=================================================================

It won't be pretty yet since we still have to think up a scheme that allows the rotation to smoothly move towards the desired rotation instead of just jumping to it.

For now this will help get things started anyways.

PARTNERS