Hi, I am trying to make a flying game in which the player races around a track I have made. At the moment I have the plane moving around, albeit in a pretty bad way but what I would like to ask is about the dbRollObjectLeft/Right.
At the moment I am rolling it right 30 when the left key is pressed. All it does it is continually do a 360 roll. How would I make it so that when it reaches the right amount of roll I wish to achieve it stops rolling anymore?
This is the code I tried and I assume I have set the variables at the top wrong and resetting it's position but I just can't think of how to do it.....
#include "DarkGDK.h"
#include "Player.h"
float xPos = 490;
float yPos = 190;
float zPos = 500;
float xCamPos = xPos-25;
float yCamPos = yPos+20;
float zCamPos = zPos;
const int leftRoll = 30;
const float rightRoll = 30;
const float leftAng = 0;
const float rightAng = 0;
void playerSetup(void)
{
dbLoadObject("Models/JetFigh2/H-Jet Fighter 2-Move.x", 15);
dbLoadImage("Models/JetFigh2/JetFigh2.dds", 16);
dbTextureObject(15,16);
dbPositionObject(15,xPos,yPos,zPos);
dbRotateObject(15,0,180,0);
dbMakeCamera(100);
dbRotateCamera(100,30,0,0);
}
void playerUpdate(void)
{
if (dbDownKey()==1)
{
dbMoveObject(15,5);
}
if (dbUpKey()==1)
{
dbMoveObject(15,-5);
}
if (dbLeftKey()==1)
{
dbMoveObjectLeft(15,-5);
dbRollObjectRight(15,rightRoll);
}
else if (dbLeftKey()==0)
{
dbRollObjectRight(15,rightAng);
}
if (dbRightKey()==1)
{
dbMoveObjectRight (15,-5);
}
//dbPrint(dbObjectPositionX(15));
}
void camFollow(void)
{
dbPositionCamera(100,dbObjectPositionX(15),dbObjectPositionY(15)+30,dbObjectPositionZ(15)-50);
}
Think of my game as being like Wipeout (if you have played it). That's the kind of movement, roll, turning I'd like to try and get close to.
Thanks