Score interacting with time/position
Posted: Sun Jul 08, 2007 8:13 am
Hi,
Ok, I need help with a scoring system for my game. I have a target area in the middle of the screen and I want the size of the score points awarded to increase as the mouse pointer nears the co-ordinates (0, 0). Also, at the same time, I want the score points to be awarded each time a second passes on the clock. Heres a section of my code (excuse the newbness)
if ((xmouse >= 0) && (xmouse <= 34))
{
xmouseSCR = xmouse;
}
else if ((xmouse <= 0) && (xmouse >= -34))
{
xmouseSCR = (xmouse * (-1));
}
else
{
xmouseSCR = 0;
}
if ((ymouse >= 0) && (ymouse <= 34))
{
ymouseSCR = ymouse;
}
else if ((ymouse <= 0) && (ymouse >= -34))
{
ymouseSCR = ymouse * (-1);
}
else
{
ymouseSCR = 0;
}
score = score + (70 - (xmouseSCR + ymouseSCR));
*edit*
Ok, so this code executes when your in teh 'score zone'. I've got it on collision (a box wiht the below dimensions represents the zone), repeat,
but I want it to only execute every half a second or so.
*edit*
Points are awarded once the pointer reaches a box who's corner coordinates are (34, 34), (34, -34), (-34, -34), (-34, 34). The score is supposed to increase as you reach the center, but instead the score goes wild as soon as I enter the zone, and pays no heed to the clock counter . Any help would be greatly appreciated!
Ok, I need help with a scoring system for my game. I have a target area in the middle of the screen and I want the size of the score points awarded to increase as the mouse pointer nears the co-ordinates (0, 0). Also, at the same time, I want the score points to be awarded each time a second passes on the clock. Heres a section of my code (excuse the newbness)
if ((xmouse >= 0) && (xmouse <= 34))
{
xmouseSCR = xmouse;
}
else if ((xmouse <= 0) && (xmouse >= -34))
{
xmouseSCR = (xmouse * (-1));
}
else
{
xmouseSCR = 0;
}
if ((ymouse >= 0) && (ymouse <= 34))
{
ymouseSCR = ymouse;
}
else if ((ymouse <= 0) && (ymouse >= -34))
{
ymouseSCR = ymouse * (-1);
}
else
{
ymouseSCR = 0;
}
score = score + (70 - (xmouseSCR + ymouseSCR));
*edit*
Ok, so this code executes when your in teh 'score zone'. I've got it on collision (a box wiht the below dimensions represents the zone), repeat,
but I want it to only execute every half a second or so.
*edit*
Points are awarded once the pointer reaches a box who's corner coordinates are (34, 34), (34, -34), (-34, -34), (-34, 34). The score is supposed to increase as you reach the center, but instead the score goes wild as soon as I enter the zone, and pays no heed to the clock counter . Any help would be greatly appreciated!