Re: "A FPS Game" Online Game
Posted: Mon Jan 26, 2009 3:00 pm
Thanks,
I'm not so good with physics... lol
But everything else is easy stuff...
I'm not so good with physics... lol
But everything else is easy stuff...
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
Did you notice that you are straying off topic by saying that?Aeolus wrote:There a admin has seemed to clean this thread, lol so please stay on topic about your game and no more racism.
Thanks Superadmindude.
^Phone post?Aeolus wrote:Yeah i always tend to go off topic, especially when im typing on my phone while driving.
You can tell in my posts when im on my phone (short messages and they go offtopic sometimes) and when im on my desktop where they are long line this and us correct grammar.
well... (most of) his grammar is correct; he just needs to work on spelling.eatcomics wrote:^Phone post?Aeolus wrote:Yeah i always tend to go off topic, especially when im typing on my phone while driving.
You can tell in my posts when im on my phone (short messages and they go offtopic sometimes) and when im on my desktop where they are long line this and us correct grammar.
The binary isn't working... and I'm too lazy to compile it myself.LeonBlade wrote:Ahh... the game...
Well, there is "some" progress... but until I get collision working, there will be no progress at all!
However, luckily for you, I got the source code for you all to download and you can try your hand at my game...
I have some sort of collision detection going on...
Note: The code is VERY unorganized and not OO (lol)
Just look for the CheckCollisions() method on you should see what I'm trying to do...
You may download this here
Code: Select all
private void CheckCollisions()
{
for (int i = 0; i < 6; i++)
{
if (player.Center.X < objects[i].Center.X + 200)
{
player.VelocityX = 0f;
player.PositionX += 1f;
}
if (player.Center.Z < objects[i].Center.Z + 200)
{
player.VelocityZ = 0f;
player.PositionZ += 1f;
}
}
}
Code: Select all
//put this somewhere
enum
{
axisX = 1,
axisY = 2,
axisZ = 4,
}
private void CheckCollisions()
{
for(int i = 0; i < 6; i++)
{
//I'm guessing the 200 is the radius
//playerRadius and objRadius are 200
if(SphereCollision(player.Center, objects[i].Center, playerRadius, objRadius) == true)
{
if(SphereCollisionOnAxis(player.Center, objects[i].Center, playerRadius, objRadius, axisX) == true)
player.Velocity.X = 0.0f;
if(SphereCollisionOnAxis(player.Center, objects[i].Center, playerRadius, objRadius, axisY) == true)
player.Velcoity.Y = 0.0f;
if(SphereCollisionOnAxis(player.Center, objects[i].Center, playerRadius, objRadius, axisZ) == true)
player.Velocity.Z = 0.0f;
}
//And why the hell were you adding 1f to player position when you wanted to stop movement
}
}
Code: Select all
private bool SphereCollision(Vector3 objA, Vector3 objB, float radiusA, float radiusB)
{
//I'm almost certain this whole thing is wrong since it used to check if a point was in a circle not a Sphere, and not Sphere to Sphere
//checking
float x_delta = objA.X - objB.X;
float y_delta = objA.Y - objB.Y;
float z_delta = objA.Z - objB.Z;
float r_delta = sqrt((x_delta * x_delta + y_delta * y_delta + z_delta * z_delta));
return r_delta<=(radiusA + radiusB);
};
private bool SphereCollisionOnAxis(Vector3 objA, Vector3 objB, float radiusA, float radiusB, long axis)
{
if(axis == axisX)
{
float x_delta = objA.X - objB.X;
float r_delta = sqrt((x_delta * x_delta));
return r_delta<=(radiusA + radiusB);
}
if(axis == axisY)
{
float y_delta = objA.Y - objB.Y;
float r_delta = sqrt((y_delta * y_delta));
return r_delta<=(radiusA + radiusB);
}
if(axis == axisZ)
{
float z_delta = objA.Z - objB.Z;
float r_delta = sqrt((z_delta * z_delta));
return r_delta<=(radiusA + radiusB);
}
};