Advertisement
Guest User

My code

a guest
Apr 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Clicker_Game
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         private Timer gameLoop = new Timer();
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.             gameLoop.Interval = 1000;
  20.             gameLoop.Tick += Update;
  21.             button2.Text = "Click here to buy Cookieze slave Cost 10 PP";
  22.         }
  23.         // Makes it so everytime you click the button it will add 1 to PP
  24.         private double pp = 0;
  25.         private int cslave = 0;
  26.         private double cSlaveC = 10;
  27.  
  28.         private void Button1_Click(object sender, EventArgs e)
  29.         {
  30.             pp++;
  31.             string current = "Your current PP is ";
  32.             label1.Text = current + pp.ToString();
  33.         }
  34.  
  35.         private void Button2_Click(object sender, EventArgs e)
  36.         {
  37.             if (pp >= cSlaveC)
  38.             {
  39.                 gameLoop.Start();
  40.                 pp -= cSlaveC;
  41.                 string current = "Your current PP is ";
  42.                 label1.Text = current + pp.ToString();
  43.                 cslave++;
  44.                 cSlaveC = cSlaveC * 2;
  45.                 string cslaveM = "You currently have ";
  46.                 string cslaveW = " Cookieze slaves";
  47.                 label2.Text = cslaveM + cslave + cslaveW;
  48.                 button2.Text = "Click here to buy Cookieze slave Cost " + cSlaveC + " PP";
  49.  
  50.             }
  51.  
  52.         }
  53.         private void Update(object sender, EventArgs e)
  54.         {
  55.             gameLoop.Start();
  56.             pp++;
  57.         }
  58.  
  59.     }  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement