public void DropBlock() { if (Canvas.GetTop(Settings.block) < 600 - tower.getLastBlockTop()) { Canvas.SetTop(Settings.block, Canvas.GetTop(Settings.block) + Settings.moveStep); } else if (tower.isInRange(Canvas.GetLeft(Settings.block)))//blokelis uzsistackino { Random rnd = new Random(); int gift_num = rnd.Next(0, 10); Settings.totalPoints += 1; if (gift_num < 2) { Gift g = new BravoPackage(); g.MakeGift(); } if (gift_num == 9) { Gift g = new AlphaPackage(); g.MakeGift(); } health.Content = Settings.healths; scoreLabel.Content = Settings.totalPoints; IBridge IBridge = this; AbstractBridge bridge = new AbstractBridge(IBridge); bridge.CallBlockCollision(); } else if (Canvas.GetTop(Settings.block) < 700)//blokelis nukrito { Canvas.SetTop(Settings.block, Canvas.GetTop(Settings.block) + Settings.moveStep); } else { loseBlock(); Settings.healths -= 1; health.Content = Settings.healths; if (Settings.healths < 1) { this.Close(); } } }
public void DropBlock() { if (Canvas.GetTop(Settings.block) < 600 - tower.getLastBlockTop()) { Canvas.SetTop(Settings.block, Canvas.GetTop(Settings.block) + Settings.moveStep); } else if (tower.isInRange(Canvas.GetLeft(Settings.block)))//blokelis uzsistackino { IBridge IBridge = this; AbstractBridge bridge = new AbstractBridge(IBridge); bridge.CallBlockCollision(); } else if (Canvas.GetTop(Settings.block) < 700)//blokelis nukrito { Canvas.SetTop(Settings.block, Canvas.GetTop(Settings.block) + Settings.moveStep); } else { loseBlock(); } }
public void DropBlock() { //connection.Open(); if (!created) { int x = (int)Canvas.GetLeft(Settings.block); using (var command = connection.CreateCommand()) { command.CommandText = @"INSERT INTO blocks (x, username) VALUES (@x, @test);"; command.Parameters.AddWithValue("@x", x); command.Parameters.AddWithValue("@test", "martynas"); command.ExecuteNonQuery(); Console.WriteLine("Finished creating table"); } created = true; } if (Canvas.GetTop(Settings.block) < 600 - tower.getLastBlockTop()) { Canvas.SetTop(Settings.block, Canvas.GetTop(Settings.block) + Settings.moveStep); } else if (tower.isInRange(Canvas.GetLeft(Settings.block)))//blokelis uzsistackino { IBridge IBridge = this; AbstractBridge bridge = new AbstractBridge(IBridge); bridge.CallBlockCollision(); } else if (Canvas.GetTop(Settings.block) < 700)//blokelis nukrito { Canvas.SetTop(Settings.block, Canvas.GetTop(Settings.block) + Settings.moveStep); } else { loseBlock(); } }