milestone count down added

This commit is contained in:
Helio 2021-05-27 12:41:00 +02:00
parent 522cf306f4
commit 355e7f6a47
20 changed files with 66 additions and 41 deletions

Binary file not shown.

View file

@ -21,25 +21,21 @@ namespace Catch_the_button {
static Label btn;
static Form frm;
static Label eta;
static Panel[] hp_indicators = new Panel[5];
static Label milestone;
static int delay = 2000;
const int milestoneCount = 20;
const int delaydown = 200;
static internal void Init(Label opts, Label ohp, Panel omenu, Label obutton,
Form oform, Label oeta) {
Form oform, Label oeta, Label omilestone) {
pts = opts;
hp = ohp;
menu = omenu;
btn = obutton;
frm = oform;
eta = oeta;
milestone = omilestone;
SetTimers();
}
static internal void HealthInit(Panel ohp1, Panel ohp2, Panel ohp3, Panel ohp4) {
hp_indicators[0] = ohp1;
hp_indicators[1] = ohp2;
hp_indicators[2] = ohp3;
hp_indicators[3] = ohp4;
hp_indicators[4] = ohp4;
}
static private void SetTimers() {
timer = new Timer();
timer.Interval = delay;
@ -96,14 +92,14 @@ namespace Catch_the_button {
}
if (stpwch.ElapsedMilliseconds < 500 && !(obj is Form || obj is System.Timers.Timer)) {
points += 2;
if (points % 20 == 0) {
delay -= 200;
if (points % milestoneCount == 0 && delay > 400) {
delay -= delaydown;
}
}
else if (stpwch.ElapsedMilliseconds >= 500 && !(obj is Form || obj is System.Timers.Timer)) {
points++;
if (points % 20 == 0) {
delay -= 200;
if (points % milestoneCount == 0 && delay > 400) {
delay -= delaydown;
}
}
else if (obj is System.Timers.Timer || obj is Form) {
@ -137,10 +133,13 @@ namespace Catch_the_button {
btn.Visible = btn.Enabled = false;
menu.Visible = menu.Enabled = true;
eta.Text = "New Position in: ...";
milestone.Text = "New Milestone in: ...";
}
static private void UpdateText() {
pts.Text = "Points: " + points;
hp.Text = "HP: "+(3 - miss).ToString();
int ml = points + (milestoneCount - (points - milestoneCount * ((points - points % milestoneCount) / milestoneCount)));
milestone.Text = "Next Milestone in: " + (ml-points);
}
static void newPos() {
btn.Location = new Point(

View file

@ -36,44 +36,44 @@ namespace Catch_the_button {
//
this.score.AutoSize = true;
this.score.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.score.Location = new System.Drawing.Point(13, 124);
this.score.Location = new System.Drawing.Point(13, 80);
this.score.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.score.Name = "score";
this.score.Size = new System.Drawing.Size(238, 36);
this.score.Size = new System.Drawing.Size(190, 29);
this.score.TabIndex = 0;
this.score.Text = "Your score is: ...";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 189);
this.label1.Location = new System.Drawing.Point(14, 123);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(267, 29);
this.label1.Size = new System.Drawing.Size(210, 24);
this.label1.TabIndex = 1;
this.label1.Text = "Please enter your name";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(13, 229);
this.label2.Location = new System.Drawing.Point(14, 147);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(377, 29);
this.label2.Size = new System.Drawing.Size(295, 24);
this.label2.TabIndex = 2;
this.label2.Text = "(leave blank to not save the score)";
//
// name
//
this.name.Location = new System.Drawing.Point(13, 280);
this.name.Location = new System.Drawing.Point(18, 187);
this.name.Margin = new System.Windows.Forms.Padding(4, 7, 4, 7);
this.name.Name = "name";
this.name.Size = new System.Drawing.Size(373, 34);
this.name.Size = new System.Drawing.Size(373, 28);
this.name.TabIndex = 3;
//
// submit
//
this.submit.Location = new System.Drawing.Point(292, 328);
this.submit.Location = new System.Drawing.Point(297, 229);
this.submit.Margin = new System.Windows.Forms.Padding(4, 7, 4, 7);
this.submit.Name = "submit";
this.submit.Size = new System.Drawing.Size(94, 41);
@ -86,18 +86,18 @@ namespace Catch_the_button {
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(34, 27);
this.label3.Location = new System.Drawing.Point(63, 9);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(339, 69);
this.label3.Size = new System.Drawing.Size(272, 55);
this.label3.TabIndex = 5;
this.label3.Text = "Game Over";
//
// LeaderDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 22F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(407, 415);
this.ClientSize = new System.Drawing.Size(408, 290);
this.Controls.Add(this.label3);
this.Controls.Add(this.submit);
this.Controls.Add(this.name);

View file

@ -81,6 +81,7 @@ namespace Catch_the_button {
static internal void Write() {
Form leaderboardDialog = new LeaderDialog(Game.points, form);
leaderboardDialog.ShowDialog();
if (Leaderboards.Count < 1) return;
string leaderboardtxt = "";
foreach (LeaderboardEntry entry in Leaderboards) {
leaderboardtxt += $"{entry.name}:{entry.points}\n";

View file

@ -44,6 +44,7 @@ namespace Catch_the_button {
this.label4 = new System.Windows.Forms.Label();
this.quit = new System.Windows.Forms.Button();
this.start = new System.Windows.Forms.Button();
this.milestone = new System.Windows.Forms.Label();
this.Menu.SuspendLayout();
this.stats.SuspendLayout();
this.groupBox1.SuspendLayout();
@ -93,6 +94,7 @@ namespace Catch_the_button {
// stats
//
this.stats.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.stats.Controls.Add(this.milestone);
this.stats.Controls.Add(this.timeleft);
this.stats.Controls.Add(this.hp);
this.stats.Controls.Add(this.ptsCount);
@ -106,7 +108,7 @@ namespace Catch_the_button {
this.timeleft.AutoSize = true;
this.timeleft.Location = new System.Drawing.Point(-1, 5);
this.timeleft.Name = "timeleft";
this.timeleft.Size = new System.Drawing.Size(230, 23);
this.timeleft.Size = new System.Drawing.Size(189, 19);
this.timeleft.TabIndex = 7;
this.timeleft.Text = "New Position in: ...";
//
@ -116,7 +118,7 @@ namespace Catch_the_button {
this.hp.AutoSize = true;
this.hp.Location = new System.Drawing.Point(783, 6);
this.hp.Name = "hp";
this.hp.Size = new System.Drawing.Size(65, 23);
this.hp.Size = new System.Drawing.Size(54, 19);
this.hp.TabIndex = 1001;
this.hp.Text = "HP: 3";
//
@ -126,7 +128,7 @@ namespace Catch_the_button {
this.ptsCount.AutoSize = true;
this.ptsCount.Location = new System.Drawing.Point(843, 6);
this.ptsCount.Name = "ptsCount";
this.ptsCount.Size = new System.Drawing.Size(109, 23);
this.ptsCount.Size = new System.Drawing.Size(90, 19);
this.ptsCount.TabIndex = 0;
this.ptsCount.Text = "Points: 0";
//
@ -135,7 +137,7 @@ namespace Catch_the_button {
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(538, 143);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(131, 23);
this.label7.Size = new System.Drawing.Size(108, 19);
this.label7.TabIndex = 16;
this.label7.Text = "budget Osu!";
//
@ -144,7 +146,7 @@ namespace Catch_the_button {
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(47, 209);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(197, 23);
this.label2.Size = new System.Drawing.Size(162, 19);
this.label2.TabIndex = 15;
this.label2.Text = "Click the buttons";
//
@ -175,7 +177,7 @@ namespace Catch_the_button {
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(108, -1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(131, 23);
this.label1.Size = new System.Drawing.Size(108, 19);
this.label1.TabIndex = 2;
this.label1.Text = "Leaderboard";
//
@ -198,7 +200,7 @@ namespace Catch_the_button {
this.highscore.AutoSize = true;
this.highscore.Location = new System.Drawing.Point(6, 22);
this.highscore.Name = "highscore";
this.highscore.Size = new System.Drawing.Size(98, 23);
this.highscore.Size = new System.Drawing.Size(81, 19);
this.highscore.TabIndex = 8;
this.highscore.Text = "No Entry";
this.highscore.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@ -209,7 +211,7 @@ namespace Catch_the_button {
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(125, -2);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 23);
this.label3.Size = new System.Drawing.Size(90, 19);
this.label3.TabIndex = 7;
this.label3.Text = "Highscore";
//
@ -223,7 +225,7 @@ namespace Catch_the_button {
this.title.Location = new System.Drawing.Point(302, 98);
this.title.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.title.Name = "title";
this.title.Size = new System.Drawing.Size(440, 56);
this.title.Size = new System.Drawing.Size(356, 45);
this.title.TabIndex = 0;
this.title.Text = "Catch the Button";
this.title.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -237,7 +239,7 @@ namespace Catch_the_button {
this.label6.Location = new System.Drawing.Point(388, 16);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(223, 251);
this.label6.Size = new System.Drawing.Size(178, 200);
this.label6.TabIndex = 11;
this.label6.Text = "2";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -248,7 +250,7 @@ namespace Catch_the_button {
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 403);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(263, 23);
this.label5.Size = new System.Drawing.Size(216, 19);
this.label5.TabIndex = 10;
this.label5.Text = "ESC - quit to main menu";
//
@ -258,7 +260,7 @@ namespace Catch_the_button {
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 367);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(109, 23);
this.label4.Size = new System.Drawing.Size(90, 19);
this.label4.TabIndex = 9;
this.label4.Text = "Controls:";
//
@ -286,9 +288,19 @@ namespace Catch_the_button {
this.start.UseVisualStyleBackColor = true;
this.start.Click += new System.EventHandler(this.start_Click);
//
// milestone
//
this.milestone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.milestone.AutoSize = true;
this.milestone.Location = new System.Drawing.Point(569, 6);
this.milestone.Name = "milestone";
this.milestone.Size = new System.Drawing.Size(207, 19);
this.milestone.TabIndex = 1002;
this.milestone.Text = "Next Milestone in: ...";
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 23F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 19F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(963, 520);
this.Controls.Add(this.Menu);
@ -335,6 +347,7 @@ namespace Catch_the_button {
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel stats;
internal System.Windows.Forms.Label milestone;
}
}

View file

@ -20,7 +20,7 @@ namespace Catch_the_button {
}
private void Form1_Load(object sender, EventArgs e) {
Game.Init(ptsCount, hp, Menu, button, this, timeleft);
Game.Init(ptsCount, hp, Menu, button, this, timeleft, milestone);
Leaderboard.Init(ldrboard, this, highscore);
button.Parent = stats.Parent = this;
}

View file

@ -1,3 +1,4 @@
test:69
helio 2.9:28
helo 000:38
helio 2.9:28
Helio 3.0 rev 2:82

View file

@ -19,3 +19,14 @@ C:\Users\vasik\Desktop\Catch the button\Catch the button\bin\Debug\Catch the but
C:\Users\helio\source\repos\Catch the button\Catch the button\obj\Debug\Catch the button.csproj.AssemblyReference.cache
C:\Users\helio\source\repos\Catch the button\Catch the button\obj\Debug\Catch_the_button.Main.resources
C:\Users\helio\source\repos\Catch the button\Catch the button\obj\Debug\Catch_the_button.LeaderDialog.resources
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\bin\Debug\Catch the button.exe.config
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\bin\Debug\Catch the button.exe
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\bin\Debug\Catch the button.pdb
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch the button.csproj.AssemblyReference.cache
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch_the_button.Main.resources
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch_the_button.LeaderDialog.resources
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch_the_button.Properties.Resources.resources
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch the button.csproj.GenerateResource.cache
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch the button.csproj.CoreCompileInputs.cache
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch the button.exe
C:\Users\vasik\Documents\GitHub\Catch-the-Button-2\Catch the button\obj\Debug\Catch the button.pdb