I'm not gonna be apologizing for using bgt heh, although I'm supposed to get around to learning something else. But after not having used it for years I figured I'd rewrite one of my favourite games - super deecout.
I could've used simpler code but I wanted the function to be reusable.
Anyway this throws up an error I can't seem to solve. I don't remember how to work with handles it seems.
class coin
{
double x;
double y;
coin()
{
}
}
coin@[] generate_coinmap(int coin_counter, int map_size)
{
coin@[] coinrun;
coinrun.resize(coin_counter);
int tempy;
int tempx;
for(int counter=0; counter <coinrun.length()-1; counter++)
{
coinrun[counter].y=random(1, map_size);
coinrun[counter].x=random(1, map_size);
tempy=coinrun[counter].y;
tempx=coinrun[counter].x;
for(int counter2=0; counter2<=counter; counter2++)
{
if((coinrun[counter2].y==tempy)&&(coinrun[counter2].x==tempx))
{
counter--;
break;
}
}
}
return coinrun;
}
// this next part was just to test the coin list generator but is incomplete because of the runtime errors.
void main()
{
file lol;
coin@[] feck;
feck=generate_coinmap(20, 20);
string hunt;
lol.open("output.txt", "w");
for(int heh=0; heh<feck.length()-1; heh++)
{
hunt+""+feck[heh].y+", "+feck[heh].x+"\r\n";
}
}
Pages 1