LOL IT IS MUSHU
By uavfun ,
Remember  Drunk code and posts are responsible for billions of dollars in lost revenue every year.
 Read more...

 0 comments
 196 views
By uavfun ,
By uavfun ,
For each player 'p':
bool won = false;
for (int i = 0; i < 3; i++)
{
// Column
if (gameBoard == p && gameBoard[i + 3] == p && gameBoard[i + 6] == p)
won = true;
// Row
if (gameBoard[i * 3] == p && gameBoard[i * 3 + 1] == p && gameBoard[i * 3 + 2] == p)
won = true;
}
// Diagonal
if (gameBoard[4] == p) // center
{
if (gameBoard[0] == p && gameBoard[8] == p)
won = true;
if (gameBoard[2] == p && gameBoard[6] == p)
won = true;
}
for (int i = 0; i < numberOfVertices; i++)
{
float angle = 2 * pi * (float)i / numberOfVertices;
float radius = random between minRadius, maxRadius;
Vertex = Vector2(radius * cos(angle), radius * sin(angle));
}
bool keyLeft, keyRight;
// When the left arrow is pressed:
keyLeft = true;
TurnDirection = left;
// When the left arrow is released:
keyLeft = false;
if (keyRight)
TurnDirection = right;
else
TurnDirection = 0;
// On update:
float deltaTime; // time in seconds since last update
if (TurnDirection == left)
direction = deltaTime * turning speed in radians per second;
else ...
Vector2 position, velocity, acceleration;
...
calculate acceleration based on what direction the ship is pointing, and whether the user is pressing the thrust button
...
position = position + velocity * deltaTime + acceleration * (deltaTime * deltaTime / 2);
velocity = velocity + acceleration * deltaTime;
acceleration.x = amount * cos(direction);
acceleration.y = amount * sin(direction);
// Drag
acceleration = acceleration  (small number) * velocity;
float3 clrIn = tex2D(Texture0, texCoord).rgb;
float3 responseR = float3( 1.0, b, a);
float3 responseG = float3( b, 1.0, b);
float3 responseB = float3( a, b, 1.0);
clr.r = dot(clrIn, responseR);
clr.g = dot(clrIn, responseG);
clr.b = dot(clrIn, responseB);
clr = 1  exp(exposure * tint.rgb * clr);
return float4(clr.r, clr.g, clr.b, 1);
clr = exposure * tint.rgb * clr;
return float4(clr.r, clr.g, clr.b, 1);
// first build a coordinate system with Z as the normal
// make X anything perpendicular to Z, then Y = Z cross X
CVector3 origin, X, Y, Z;
...
// now shoot the rays
unsigned hit, total;
for (unsigned u = 0; u < samples; u++)
{
float phi = u * pi / samples;
float c = cos(phi);
for (unsigned v = 0; v < samples; v++)
{
float theta = 2.0f * pi * v / samples;
float x = c * cos(theta);
float y = c * sin(theta);
float z = sin(phi);
total++;
const CVector3 dir = x * X + y * Y + z * Z;
// Test ray against mesh
// Note highly scientific fudge factor
if (test mesh against ray(origin + dir * 0.001f, dir))
hit++;
}
}
// Store result
float f = 1.0f  float(hit) / float(total);
vertex colour = CColour4(f, f, f, 1.0f);
By uavfun ,
By uavfun ,
By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.
Participate in the game development conversation and more when you create an account on GameDev.net!
Sign me up!