0
Is it going to work? Balls vs Blocks phone game I tried to make using Visual Studio winforms
Balls vs Blocks Game! At the moment I don't have a PC and would appreciate if you guys take a look and tell me if it's going to work or not. Since I have only 512 characters I will post the rest of the code in the comment below! int player_value = 10; int[] block_value = new int[10]; PictureBox[] blocks = new PictureBox [10]; Label[] block_value_display = new Label[10]; PictureBox[] food = new PictureBox[5]; int[] food_value = new int[5];
1 Antwort
0
void Game_Load()
{
int min_value = player_value / 2;
for( int i =0; i<= block_value.Lenght; i++)
{
block_value[i] = rnd.Next(min_value, 31);
block_value_display[i].Text = block_value[i].ToString();
}
block.Location = new Point ( -200, block.location.x);
block_value_display.Location = new Point ( same here);
for(int i = 0; i<=food_value.lenght; i++)
{
food_value[i] = rnd.Next(1,6);
if(food_value[i] == 1)
food[i].Image = Image.FromFile(img1);
//And so on...
}
Timer()
{
foreach(PictureBox block in blocks)
block.Location = new Point ( block.Location.X, +5);
foreach(Label lbl in block_value_display)
// same here..
if( blocks.Top >= this.Height)
//Writing stuff from Game_Load..
Collisions();
}
void Collisions()
{
for( int i = 0; i<= blocks.Lenght; i++)
{
if(player.Bounds.IntersectsWith(block[i].Bounds))
{
//Stop block movement..
player_value-=block[i]. ToString ();
if(player_value > 0)
{
block[i].Hide();
block_value_display[i].Hide();
//Start block movement..
}
else { EndGame(); }
}
}