aboutsummaryrefslogtreecommitdiff
path: root/source/WindowsFormsApplication1/Jumper.cs
diff options
context:
space:
mode:
authorMichaelTheShifter <[email protected]>2016-06-25 08:10:03 -0400
committerMichaelTheShifter <[email protected]>2016-06-25 08:10:03 -0400
commit84f689b91a73e512b035df40bbcf556b008a3b81 (patch)
treeda1020b2b5866c7ce300ac7b9c97112fe80fa1b3 /source/WindowsFormsApplication1/Jumper.cs
parent6707e2076a63dafab686fd533c95fb8ceb6c23fa (diff)
downloadshiftos-c--84f689b91a73e512b035df40bbcf556b008a3b81.tar.gz
shiftos-c--84f689b91a73e512b035df40bbcf556b008a3b81.tar.bz2
shiftos-c--84f689b91a73e512b035df40bbcf556b008a3b81.zip
Sort source code into folders.
It feels better to know what's responsible for what... Plus I removed some un-needed C# stuff.
Diffstat (limited to 'source/WindowsFormsApplication1/Jumper.cs')
-rw-r--r--source/WindowsFormsApplication1/Jumper.cs146
1 files changed, 0 insertions, 146 deletions
diff --git a/source/WindowsFormsApplication1/Jumper.cs b/source/WindowsFormsApplication1/Jumper.cs
deleted file mode 100644
index 766c929..0000000
--- a/source/WindowsFormsApplication1/Jumper.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ShiftOS
-{
- public partial class Jumper : Form
- {
- public Jumper()
- {
- InitializeComponent();
- }
-
- enum GameStatus
- {
- Idle,
- GameOver,
- Playing
- }
-
- private GameStatus status = GameStatus.Idle;
- private int JumpingStage = 0; //not jumping
-
- int gamespeed = 1;
- int codepointsearned = 0;
-
- Random rand = new Random();
-
- private void tmrscreenupdate_Tick(object sender, EventArgs e)
- {
- ground.Location = new Point(0, 260);
- ground.Size = new Size(this.ClientRectangle.Width, 2);
- ground.BackColor = Color.Black;
- switch(JumpingStage)
- {
- case 0:
- player.Location = new Point(100, 228);
- break;
- case 1:
- if(player.Location.Y != 200)
- {
- player.Location = new Point(player.Location.X, player.Location.Y - 5);
- } else
- {
- JumpingStage = 2;
- }
- break;
- case 2:
- if (player.Location.Y != 228)
- {
- player.Location = new Point(player.Location.X, player.Location.Y + 5);
- }
- else
- {
- JumpingStage = 0;
- lbstatus.Text = "Landed";
- }
- break;
-
- }
- int randres = rand.Next(0, 9);
- switch(randres)
- {
- case 5:
- Panel enemy = new Panel();
- this.Controls.Add(enemy);
- enemy.Location = new Point(this.ClientRectangle.Width, 227);
- enemy.BackColor = Color.Black;
- enemy.Size = new Size(32, 27);
- enemy.Tag = "enemy";
- enemy.Show();
- break;
- }
-
- foreach (Control ctrl in this.Controls)
- {
- string enemytag = "enemy";
- if (enemytag == (string)ctrl.Tag)
- {
- if (ctrl.Location.X < 0 - ctrl.Width)
- {
- ctrl.Hide();
- }
- else
- {
- ctrl.Location = new Point(ctrl.Location.X - (2 * gamespeed), ctrl.Location.Y);
- }
- if (ctrl.Left >= player.Left && ctrl.Left <= player.Right)
- {
- if(ctrl.Top >= player.Top && ctrl.Bottom <= player.Bottom)
- {
- status = GameStatus.GameOver;
- }
- }
- }
- }
-
- switch(status)
- {
- case GameStatus.Playing:
- codepointsearned += gamespeed;
- btnplay.Hide();
- lbstatus.Text = "Codepoints: " + codepointsearned.ToString();
- break;
- case GameStatus.GameOver:
- tmrscreenupdate.Stop();
- API.CreateInfoboxSession("You hit an obstacle.", "You have run into an obstacle. You have earned " + codepointsearned.ToString() + " Codepoints.", infobox.InfoboxMode.Info);
- API.AddCodepoints(codepointsearned);
- codepointsearned = 0;
- if(API.Upgrades["multitasking"] == true)
- {
- this.Close(); //Close if multitasking is true.
- }
- break;
- }
- }
-
- private void btnplay_Click(object sender, EventArgs e)
- {
- if(this.status == GameStatus.Idle)
- {
- this.status = GameStatus.Playing;
- this.Focus();
- this.KeyDown += (object s, KeyEventArgs a) =>
- {
- if (a.KeyCode == Keys.Space)
- {
- if (JumpingStage == 0)
- {
- JumpingStage = 1;
- lbstatus2.Text = "Jumping...";
- }
- a.SuppressKeyPress = true;
- }
- };
- tmrscreenupdate.Start();
- }
- }
- }
-}