-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Messing with abstract class/interface...
- Loading branch information
Showing
21 changed files
with
848 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Imports Microsoft.VisualBasic | ||
|
||
Public Class AlchemyLab | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 200000 'cost of the first one purchased | ||
Private CpS As Double = 400.0 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
11 changes: 11 additions & 0 deletions
11
CookieClickerClone/CookieClickerClone/AntimatterCondenser.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Imports Microsoft.VisualBasic | ||
|
||
Public Class AntimatterCondenser | ||
Inherits Generator | ||
|
||
Private baseCost As Long = 3999999999 'cost of the first one purchased | ||
Private CpS As Double = 999999.0 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
546 changes: 519 additions & 27 deletions
546
CookieClickerClone/CookieClickerClone/CookieClicker.Designer.vb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,115 @@ | ||
Public Class CookieClicker | ||
Dim currentCookies As Integer = 0 | ||
Dim alltimeCookies As Integer = 0 | ||
Dim currentCookies As Long = 0 | ||
Dim alltimeCookies As Long = 0 | ||
Dim buildingsOwned As Integer = 0 | ||
Dim CpS As Double = 0.0 'cookies per second | ||
Dim cookiesPerClick As Integer = 1 | ||
Dim handMadeCookies As Integer = 0 | ||
Dim cookiesPerClick As Long = 1 | ||
Dim handMadeCookies As Long = 0 | ||
Dim goldenCookies As Integer = 0 | ||
|
||
Dim time As Double = 0 | ||
Shadows cursor As New Cursor | ||
Dim grandma As New Grandma | ||
Dim farm As New Farm | ||
Dim factory As New Factory | ||
Dim mine As New Mine | ||
Dim shipment As New Shipment | ||
Dim alchemyLab As New AlchemyLab | ||
Dim portal As New Portal | ||
Dim timeMachine As New TimeMachine | ||
Dim antimatterCondenser As New AntimatterCondenser | ||
|
||
|
||
'Keeping track of the generators listed on the form (pic, button, label) | ||
Const NUMBER_OF_GENERATORS = 10 | ||
Dim generatorArray(NUMBER_OF_GENERATORS, 3) As Object 'each element of generatorArray contains: [pic, button, label] | ||
Dim typeArray() As Generator = {cursor, grandma, farm, factory, mine, shipment, alchemyLab, portal, timeMachine, antimatterCondenser} | ||
|
||
Dim time As Integer = 0 | ||
|
||
Public Shared Sub Main() | ||
|
||
Dim form As CookieClicker = New CookieClicker() | ||
form.tmrCounter.Start() | ||
Application.Run(form) | ||
|
||
'persistantly check for which things can be purchased | ||
Dim enableButtonsThread As New System.Threading.Thread(AddressOf form.enableButtons) | ||
enableButtonsThread.IsBackground = True | ||
enableButtonsThread.Start() | ||
|
||
End Sub | ||
|
||
'timer will tick every tenth of a second | ||
Private Sub tmrCounter_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrCounter.Tick | ||
time += 0.1 | ||
Label1.Text = time | ||
'update values | ||
time += 1 | ||
currentCookies += CpS / 10 | ||
alltimeCookies += CpS / 10 | ||
|
||
'update displays | ||
lblCurrentCookies.Text = currentCookies | ||
|
||
If time Mod 10 = 0 Then 'one second has passed | ||
|
||
End If | ||
End Sub | ||
|
||
Private Sub picCookie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picCookie.Click | ||
'update values | ||
currentCookies += 1 | ||
alltimeCookies += 1 | ||
|
||
'update displays | ||
lblCurrentCookies.Text = currentCookies | ||
|
||
'enable necessary buttons | ||
enableButtons() | ||
|
||
End Sub | ||
|
||
Private Sub cursor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picCursor.Click, btnCursor.Click, lblCursor.Click | ||
|
||
End Sub | ||
|
||
'continuously enable/disable all generators that can/can't be purchased with the current amount of currency possessed | ||
Private Sub enableButtons() | ||
'each element of generatorArray contains: [pic, button, label] | ||
'the following code populates the list of generators | ||
Dim index() As Integer = {0, 0, 0} 'keep track of number of [pic, button, label] seen | ||
|
||
'For Each obj As Object In pnlRight.Controls | ||
'If TypeOf obj Is PictureBox Then | ||
'End If | ||
'Next | ||
|
||
For Each item As Control In pnlRight.Controls | ||
If TypeOf item Is PictureBox Then | ||
generatorArray(index(0), 0) = item | ||
index(0) += 1 | ||
ElseIf TypeOf item Is Button Then | ||
generatorArray(index(1), 1) = item | ||
index(1) += 1 | ||
ElseIf TypeOf item Is Label Then | ||
generatorArray(index(2), 2) = item | ||
index(2) += 1 | ||
End If | ||
Next | ||
|
||
'code for enabling/disabling buttons | ||
While (True) | ||
For i As Integer = 0 To NUMBER_OF_GENERATORS - 1 | ||
'if player has enough money to buy a generator, the correspoding button, etc. should be enabled & vise-versa | ||
If currentCookies < typeArray(i).getCost() Then | ||
TryCast(generatorArray(i, 0), PictureBox).Enabled = False | ||
TryCast(generatorArray(i, 1), Button).Enabled = False | ||
TryCast(generatorArray(i, 2), Label).Enabled = False | ||
Else | ||
TryCast(generatorArray(i, 0), PictureBox).Enabled = True | ||
TryCast(generatorArray(i, 1), Button).Enabled = True | ||
TryCast(generatorArray(i, 2), Label).Enabled = True | ||
End If | ||
Next | ||
|
||
End While | ||
End Sub | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Public Class Cursor | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 15 'cost of the first one purchased | ||
Private CpS As Double = 0.1 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
|
||
End Class | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Imports Microsoft.VisualBasic | ||
|
||
Public Class Factory | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 3000 'cost of the first one purchased | ||
Private CpS As Double = 10.0 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Imports Microsoft.VisualBasic | ||
|
||
Public Class Farm | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 500 'cost of the first one purchased | ||
Private CpS As Double = 2.0 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'An abstract class for objects that auto-generate cookies every second. | ||
Public MustInherit Class Generator | ||
Private baseCost As Integer 'cost of the first one purchased | ||
Private CpS As Double 'cookies per second generated by one of this object | ||
Private amount As Integer 'number of this type of generator created | ||
Private total As Double 'number of cookies produced since beginning of game | ||
Private currentCost As Long 'base cost * 1.15 (accurate for non-cursors?) | ||
|
||
'Allows retrieval/editing of the CpS for a single generator of this type | ||
Public ReadOnly Property getCpS() As Double | ||
Get | ||
Return CpS | ||
End Get | ||
End Property | ||
|
||
|
||
'Returns the base cost of the first object purchased | ||
Public ReadOnly Property getBaseCost() As Integer | ||
Get | ||
Return baseCost | ||
End Get | ||
End Property | ||
|
||
|
||
'Allows retrieval/editing of the quantity of this generator in existance | ||
Public Property Quantity() As Integer | ||
Get | ||
Return amount | ||
End Get | ||
Set(ByVal value As Integer) | ||
amount += value | ||
End Set | ||
End Property | ||
|
||
'Allows for retrieval/editing of the total Cookies produced by this generator type | ||
Public Property TotalProduced() As Double | ||
Get | ||
Return total | ||
End Get | ||
Set(ByVal value As Double) | ||
total += value | ||
End Set | ||
End Property | ||
|
||
Public ReadOnly Property getCost() As Integer | ||
Get | ||
Return currentCost | ||
End Get | ||
End Property | ||
|
||
Public Sub updateCost() | ||
currentCost *= 1.15 | ||
End Sub | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Public Class Grandma | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 100 'cost of the first one purchased | ||
Private CpS As Double = 0.5 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Imports Microsoft.VisualBasic | ||
|
||
Public Class Mine | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 10000 'cost of the first one purchased | ||
Private CpS As Double = 40.0 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
19 changes: 19 additions & 0 deletions
19
CookieClickerClone/CookieClickerClone/My Project/Resources.Designer.vb
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-539 Bytes
(100%)
CookieClickerClone/CookieClickerClone/My Project/cookie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Imports Microsoft.VisualBasic | ||
|
||
Public Class Portal | ||
Inherits Generator | ||
|
||
Private baseCost As Integer = 1666666 'cost of the first one purchased | ||
Private CpS As Double = 6666.0 'cookies per second generated by one of this object | ||
Private amount As Integer = 0 'number of this type of generator created | ||
Private total As Double = 0 'number of cookies produced since beginning of game | ||
Private currentCost As Long = baseCost 'base cost * 1.15 (accurate for non-cursors?) | ||
End Class |
Oops, something went wrong.