After making a square and then getting the function to work for drawing a line, I had a go at something I did on graph paper at school.
I am not sure if I could have written it better, but I am rusty at C++.
Anyway just to show I am learning. Hope to carry on with the tutorials now.
I might do this again with randomizing the colour soon as well, just can't remember the code for randomizing yet. It is usually RND, but it is ages since I needed to use it.
Would be cool if I could making this spin, but then it would be back to maths again LOL. Probably something to do with cosine or something.
Code: Select all
void Game::star()
{
int movey=20;
for (int movex=400; movex < 650; movex=movex+10)
{
gfx.DrawLine(400,movey,movex,250,0,255,0);
if (movey < 250) movey=movey+10;
}
// Hieght
movey=500;
//across
for (int movex=400; movex < 650; movex=movex+10)
{
gfx.DrawLine(400,movey,movex,250,255,0,0);
if (movey > 250) movey=movey-10;
}
movey=500;
//across
for (int movex=400; movex > 150; movex=movex-10)
{
gfx.DrawLine(400,movey,movex,250,255,0,0);
if (movey > 250) movey=movey-10;
}
movey=20;
for (int movex=400; movex > 150; movex=movex-10)
{
gfx.DrawLine(400,movey,movex,250,0,255,0);
if (movey < 250) movey=movey+10;
}
}