hey, sorry to say this, but i tryed implementing this into the sparky sliding collision demo to see if i could get it working with sparky and if it also worked on the Y axis.
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(254) : warning C4101: 'prevX' : unreferenced local variable
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(254) : warning C4101: 'prevY' : unreferenced local variable
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(424) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(425) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(754) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(755) : warning C4018: '>' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(793) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(796) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(866) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(868) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(869) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(870) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1030) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1040) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1050) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1060) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1146) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1183) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1185) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1207) : warning C4305: 'initializing' : truncation from 'double' to 'const float'
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1215) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1247) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1271) : warning C4305: 'initializing' : truncation from 'double' to 'const float'
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1279) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1333) : warning C4305: 'initializing' : truncation from 'double' to 'const float'
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1341) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1377) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1391) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1412) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1415) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1448) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1482) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1486) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1819) : warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1820) : warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1821) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1834) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1834) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1834) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1834) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1835) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1835) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1843) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1843) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1878) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1882) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1901) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1902) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1928) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1932) : warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1933) : warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1934) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1943) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1943) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1943) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1943) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1947) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1947) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1947) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1947) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1952) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1953) : warning C4018: '<' : signed/unsigned mismatch
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1967) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1967) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1967) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\pathfinding.h(1967) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\movement.h(41) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\movement.h(42) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\main.cpp(34) : warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
c:\documents and settings\admin\desktop\gdkcollisions_v2.05c\samples\slidingdemo\main.cpp(62) : warning C4101: 'AI' : unreferenced local variable
sarcasm says it went well.
im not a c++ whizz and im not sure what all that means, and i have reviewed your code and i cant see why it isnt working.
my code is only 130 lines long, and most of it is your code, so ill post it here:
#include "DarkGDK.h"
#include "Pathfinding.h"
#include "SC_Collision.h"
#include "Camera.h"
#include "Movement.h"
#include "MakeWorld.h"
#include "HUD.h"
#include "AI.h"
void DarkGDK( )
{
dbSyncOn( );
dbMaximizeWindow();
//dbSetDisplayMode (1024,768,32);
dbSetWindowTitle ( "Outscape - The Annihilation" );
dbRandomize ( dbTimer() );
dbHideMouse ();
dbAutoCamOff( );
SC_Start( );
initializeDebug( );
makeLevel();
// only object i want checked is object 1.
const int NMB_OBSTACLES = 1;
Pathfinder map = Pathfinder( NMB_OBSTACLES + 1 );
map.addObject( 1 ); // Adds the object to the pathfinder
map.updateObjectConvexFrame( 1 ); // Generates a convex hull for the object
map.switchObjectDirection( 1 );
float AI_RADIUS_1 = dbObjectSizeX( 3 ) / 2.0;
map.updateGrid( 0, AI_RADIUS_1 );
list<Point> path1;
makePlayer();
PrepareHud();
int movetimer = 0;
int time = 0;
int startime = dbTimer();
int a = 0;
struct Aistruct
{
int id;
int x;
int y;
int z;
int team;
int health;
int target;
int nextx;
int nexty;
int nextz;
};
Aistruct AI[5];
while( LoopGDK( ) )
{
time = dbTimer();
dbPositionMouse(dbScreenWidth()/2,dbScreenHeight()/2);
dbText( 0,0,"Use W/A/S/D to move and SPACE to jump" );
if (time>movetimer+50)
{
for (a = 2; a<=3; a++)
{
if (dbObjectExist(a) == 1)
{
movePlayer(a);
}
}
movetimer = time;
}
path1 = map.getRouteForObject( 3, dbObjectPositionX(2), dbObjectPositionZ(2), 0 );
// Handle path following
if ( !path1.empty( ) )
{
// Check distance to next node
float dist = pow( (*path1.begin( )).x - dbObjectPositionX( 3 ), 2 ) +
pow( (*path1.begin( )).y - dbObjectPositionZ( 3 ), 2 );
// Check if next node has been reached
if ( dist < .25 && path1.size( )!=1 )
{
dbPositionObject( 3, (*path1.begin( )).x, dbObjectSizeY( 3 )/2, (*path1.begin( )).y );
path1.erase( path1.begin( ) ); // Pop the node off the list
}
// Check for distance to target
if ( dist < 225 && path1.size( )==1 )
path1.erase( path1.begin( ) ); // Pop the node off the list
// Move the entity along its path
if ( !path1.empty( ) )
{
dbPointObject( 3, (*path1.begin( )).x, 5, (*path1.begin( )).y );
dbMoveObject( 3, .5 );
Point target = map.getValidLocation( 0, dbObjectPositionX(3), dbObjectPositionZ(3) );
dbPositionObject( 3, target.x, dbObjectPositionY(3), target.y );
}
}
PlayerShoot(time);
PlayerAnimating(time);
DoAI(time);
dbSync( );
}
}
thanks in advance
object 1 = map.
object 2 = player.
object 3 = ai.