hey guys so i made a checkers game. looking good so far. but i cant get the object to move. can you guys show me how to move the circles. its really frustrating cant get it to work :C
here is my code:
#include "ccc_win.h"
void initNewgame(int x, int y, int r, int g, int b, PenWidth pen1, PenColour blackPen)
{
BrushColour sBrush = BrushColour(r, g, b);
Point p(6.3, 3.5);
Point p1(x - 2, y + 1);
Point p2(x + 2, y - 1);
Rectangle square(p1, p2);
string s = "New Game";
Message newGame(p, s);
cwin << pen1 << blackPen << sBrush << square << newGame;
}
void initExit(int x, int y, int r, int g, int b, PenWidth pen1, PenColour blackPen)
{
BrushColour sBrush = BrushColour(r, g, b);
Point p(15.3, 3.5);
Point p1(x - 2, y + 1);
Point p2(x + 2, y - 1);
Rectangle square(p1, p2);
string s = "Exit Game";
Message exit(p, s);
cwin << pen1 << blackPen << sBrush << square << exit;
}
void initSquare(int x, int y, int r, int g, int b, PenWidth pen1, PenColour blackPen)
{
BrushColour sBrush = BrushColour(r, g, b);
Point p(x, y);
Point p1(x - 1, y - 1);
Point p2(x + 1, y + 1);
Rectangle square(p1, p2);
cwin << pen1 << blackPen << sBrush << square;
}
void initCircle(int x, int y, int r, int g, int b, PenWidth pen1, PenColour blackPen)
{
BrushColour sBrush = BrushColour(r, g, b);
Point p(x, y);
Circle smallCircle(p, 0.8);
cwin << pen1 << blackPen << sBrush << smallCircle;
}
int ccc_win_main()
{
cwin.coord(0, 24, 24, 0);
PenWidth pen1 = PenWidth(1);
PenColour blackPen = PenColour(0, 0, 0);
bool isDark = false;
initExit(16, 3, 240, 230, 70, pen1, blackPen);
initNewgame(8, 3, 240, 230, 70, pen1, blackPen);
for (int x = 5; x < 20; x = x + 2)
{
if (isDark == true)
{
isDark = false;
}
else
isDark = true;
for (int y = 7; y < 22; y = y + 2)
{
if (isDark == true)
{
initSquare(x, y, 55, 180, 15, pen1, PenColour(0, 0, 0));
isDark = false;
}
else{
initSquare(x, y, 240, 230, 70, pen1, PenColour(0, 0, 0));
isDark = true;
}
}
}
for (int x = 5; x < 20; x = x + 4)
{
for (int y = 7; y < 12; y = y + 4)
{
initCircle(x, y, 255, 0, 0, pen1, blackPen);
}
}
for (int x = 7; x < 20; x = x + 4)
{
int y = 9;
initCircle(x, y, 255, 0, 0, pen1, blackPen);
}
for (int x = 7; x < 20; x = x + 4)
{
for (int y = 17; y < 22; y = y + 4)
{
initCircle(x, y, 255, 255, 255, pen1, blackPen);
}
}
for (int x = 5; x < 20; x = x + 4)
{
int y = 19;
initCircle(x, y, 255, 255, 255, pen1, blackPen);
}
Point p = cwin.get_mouse("check");
double x = p.get_x();
double y = p.get_y();
if (x >= 8.3 && x <= 4.3 &&
y >= 4.5 && y <= 2.5)
{
return 1;
}
return 0;
}