This is my first project i want to make a little maze game. I have one object(id=1) that can be moved by the arrow keys. And a few other. Witch code does i need to become the result that object can't move through the other object? I have sparky collision.
I searched all over the forum but i don't get it how it is just working and what you really need to type so the object doesn't move throuh the other objects.
#include "DarkGDK.h"
#include "SC_Collision.h"
void (DarkGDK ())
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbColorBackdrop(dbRgb(0,0,125));
dbMakeObjectCube(1,5);
dbLoadImage("crate1.jpg",1);
dbLoadImage("crate.png",2);
dbTextureObject(1,2);
for ( int i = 2; i < 11; i++ )
{
dbMakeObjectCube( i, 25 );
dbTextureObject(i,1);
}
dbPositionObject(2,-25,0,0);
dbPositionObject(3,-25,0,25);
dbPositionObject(4,0,0,50);
dbPositionObject(5,25,0,50);
dbPositionObject(6,25,0,0);
dbPositionObject(7,50,0,50);
dbPositionObject(8,75,0,25);
dbPositionObject(9,75,0,0);
dbPositionObject(10,0,0,-25);
while ( LoopGDK ( ) )
{
if (dbRightKey())
dbMoveObjectRight(1,1);
else if (dbLeftKey())
dbMoveObjectLeft(1,1);
else if (dbUpKey())
dbMoveObject(1,1.0);
else if (dbDownKey())
dbMoveObject(1,-1.0);
int x = dbObjectPositionX(1);
int z = dbObjectPositionZ(1);
int y = dbObjectPositionY(1);
dbPositionCamera(x,y,z-15)
dbSync ( );
}
return;
}