Cookie Clicker in Blitz
BlitzPlus Forums/BlitzPlus Programming/Cookie Clicker in Blitz| 
 | ||
| Talking about how to code Cookie Clicker in Blitz | 
| 
 | ||
| I was thinking of how to create Cookie Clicker in Blitz. here's what i have 
WinHandle=CreateWindow("Cookie Clicker",0,0,400,300)
Cookie = 0
CookieButton=CreateButton("Cookie",50,120,300,40,WinHandle) 
ExitButton=CreateButton("Exit",50,160,300,40,winhandle)
CookieLabel=CreateLabel("Cookies:"+Cookie,180,0,180,20,WinHandle,0) 
Repeat 
If WaitEvent()=$803 Then 
If EventSource()=CookieButton Then Cookie = Cookie + 1
If EventSource()=ExitButton Then Goto aEnd
SetGadgetText CookieLabel,"Cookies: " + Cookie+"" 
End If 
Forever 
End 
.aEnd
Delay 500
End
 | 
| 
 | ||
| Update 
;Create window
Window = CreateWindow("Cookie Clicker", 0,0, 400, 600, 0, 13)
;create tab
Tabber = CreateTabber(0, 0, 377,577, Window)
AddGadgetItem Tabber, "   Cookie     "
AddGadgetItem Tabber, "   Tab 2     "
;create panels for tab tabs
Panel1 = CreatePanel(0, 0, 290, 577, Tabber)
Panel2 = CreatePanel(0, 0, 290, 577, Tabber)
;hide panel that are not selected
HideGadget Panel2
; other stuff
cookie = 0
CookieButton=CreateButton("Cookie",0,120,250,40,Panel1) 
ExitButton=CreateButton("Exit",0,450,250,40,Panel1)
CookieLabel=CreateLabel("Cookies:"+Cookie,100,50,180,20,Panel1) 
;main loop
Repeat
	event = WaitEvent()
	If event = $803 Then Exit ;Close (X) button pressed
	If event = $401 ;gadget action
		Select EventSource()
			Case Tabber
				Select EventData()
					Case 0
						ShowGadget Panel1
						HideGadget Panel2
					Case 1
						HideGadget Panel1
						ShowGadget Panel2
				End Select
		End Select
	EndIf ;gadget action
	
	
;other stuff in loop	
If EventSource()=CookieButton Then Cookie = Cookie + 1
If EventSource()=ExitButton Then End
Wend 
	
Forever
;aEnd (where you would put more stuff in the future)
.aEnd
Delay 500
End
 | 
| 
 | ||
| sorry I had to create a new account!!! Im still here | 
| 
 | ||
| The Cookie Clicker source is on GitHub if you are interested.  I never got a good look at the mechanics other than it uses base64 to store save information. http://cookieclicker.wikia.com/wiki/Cookie_Clicker_Wiki That link contains algorithms for some things so that might come in handy for you. Why do you want to make a standalone replica though? |