mads3n Posted January 2, 2008 Share Posted January 2, 2008 (edited) My first attempt to make a game it isn't that well coded, and the game sure could use some improvements, but it works hope you find the game entertaining ^^ edit: heres the code (which is also included in the zip file..) edit2: you need to get the 3 pictures from the zip file or change them to something else, for the game to work edit3: Added LEVELS lol.. now the game is a lot harder.. good luck reaching 1000+ in score! expandcollapse popup#cs ---------------------------------------------------------------------------- ZAP game creator: Mads3n #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <Array.au3> MsgBox(0,"Welcome","Welcome to the game ZAP, use the arrow keys to avoid getting hitted by the lightnings. Good luck") $gui=GuiCreate("ZAP", 400, 430,-1,-1,$WS_POPUP+$WS_BORDER) GUISetBkColor (0xFFFFFF) GUICtrlCreatePic ("cloud.gif", 0, 10,400) $player=GUICreate("", 68, 70, 170, 320,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("merlin.gif",0,0, 0,0) GUISetState(@SW_SHOW,$player) GUISetState(@SW_SHOW,$gui) $start = 1 $l = 0 $score = 0 $level = 1 $scoreboard = GuiCtrlCreateLabel("Score: " & $score, 5, 5, 100, 12) $levelboard = GuiCtrlCreateLabel("Level: " & $level, 110, 5, 100, 12) Dim $lightning[5] Dim $step[5] $LPOS1 = 0 $LPOS2 = 0 $LPOS3 = 0 $LPOS4 = 0 $PlayerCurPos = 3 Call("_lightning") Func _lightning1 () $lspawn = random(1,5,1)*70 $LPOS1 = $lspawn / 70 $lspawn -= 40 $lightning[1]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[1]) $l += 1 EndFunc Func _lightning2 () $lspawn = random(1,5,1)*70 $LPOS2 = $lspawn / 70 $lspawn -= 40 $lightning[2]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[2]) $l += 1 EndFunc Func _lightning3 () $lspawn = random(1,5,1)*70 $LPOS3 = $lspawn / 70 $lspawn -= 40 $lightning[3]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[3]) $l += 1 EndFunc Func _lightning4 () $lspawn = random(1,5,1)*70 $LPOS4 = $lspawn / 70 $lspawn -= 40 $lightning[4]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[4]) $l += 1 EndFunc Func _lightning () if $score >= 100 and $level = 1 then $level += 1 elseif $score > 200 and $level = 2 then $level += 1 elseif $score > 300 and $level = 3 then $level += 1 elseif $score > 400 and $level = 4 then $level += 1 elseif $score > 500 and $level = 5 then $level += 1 elseif $score > 600 and $level = 6 then $level += 1 elseif $score > 700 and $level = 7 then $level += 1 elseif $score > 800 and $level = 8 then $level += 1 elseif $score > 900 and $level = 9 then $level += 1 elseif $score > 1000 and $level = 10 then $level += 1 endif GUICtrlSetData($levelboard, "Level: " & $level) if $start = 1 then call("_lightning1") $start += 1 Elseif $start = 2 then call("_lightning2") $start += 1 Elseif $start = 3 then call("_lightning3") $start += 1 Elseif $start = 4 then call("_lightning4") $start += 1 Endif if $step[1] = 14 Then GUIDelete($lightning[1]) $score += 10 Elseif $step[2] = 14 Then GUIDelete($lightning[2]) $score += 10 Elseif $step[3] = 14 Then GUIDelete($lightning[3]) $score += 10 Elseif $step[4] = 14 Then GUIDelete($lightning[4]) $score += 10 Endif GUICtrlSetData($scoreboard, "Score: " & $score) Call("_lmove") EndFunc Func _lmove() if $step[1] = 14 Then $lspawn = random(1,5,1)*70 $LPOS1 = $lspawn / 70 $lspawn -= 40 $lightning[1]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[1]) $step[1] = 0 Elseif $step[2] = 14 Then $lspawn = random(1,5,1)*70 $LPOS2 = $lspawn / 70 $lspawn -= 40 $lightning[2]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[2]) $step[2] = 0 Elseif $step[3] = 14 Then $lspawn = random(1,5,1)*70 $LPOS3 = $lspawn / 70 $lspawn -= 40 $lightning[3]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[3]) $step[3] = 0 Elseif $step[4] = 14 Then $lspawn = random(1,5,1)*70 $LPOS4 = $lspawn / 70 $lspawn -= 40 $lightning[4]=GUICreate("", 70, 50, $lspawn, 75,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui) GUICtrlCreatePic("bzz.gif",0,0, 0,0) GUISetState(@SW_SHOW,$lightning[4]) $step[4] = 0 Endif $lC = $l while $l > 0 $lpos = WinGetPos($lightning[$l]) WinMove($lightning[$l],"",$lpos[0],$lpos[1]+20) $step[$l] += 1 $l -= 1 WEnd $l = $lC AdlibEnable("_lightning", 500/$level) EndFunc ;Player controls HotKeySet("{Escape}", "_exit") HotKeySet("{LEFT}", "_moveleft") HotKeySet("{RIGHT}", "_moveright") ;Player Movement Func _moveleft () if $PlayerCurPos > 1 then $PlayerPos = WinGetPos($player) WinMove($player,"",$PlayerPos[0]-70,$PlayerPos[1]) $PlayerCurPos -= 1 Else Endif EndFunc Func _moveright() if $PlayerCurPos < 5 then $PlayerPos = WinGetPos($player) WinMove($player,"",$PlayerPos[0]+70,$PlayerPos[1]) $PlayerCurPos += 1 Else Endif EndFunc Func _exit() Exit EndFunc while 1 if $LPOS1 = $PlayerCurPos and $step[1] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit elseif $LPOS2 = $PlayerCurPos and $step[2] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit Elseif $LPOS3 = $PlayerCurPos and $step[3] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit elseif $LPOS4 = $PlayerCurPos and $step[4] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit Endif sleep(60) Wend zap_source.zip ^ game + source Edited January 5, 2008 by mads3n Mads3n.dk Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 4, 2008 Share Posted January 4, 2008 Mostly the EXE's are not trusted around here without a lot of reputation. Not that I want you to release source but I'm try to explain why you will have very few replies... good luck [center][/center] Link to comment Share on other sites More sharing options...
WolfWorld Posted January 4, 2008 Share Posted January 4, 2008 It kind na fun. My kasper does not said anything so it clean i think Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 4, 2008 Share Posted January 4, 2008 could you make a small attempt to spell that sentence correctly... Although I know what you meant. I'm not going to play it but I am glad that you liked it I gues. [center][/center] Link to comment Share on other sites More sharing options...
WolfWorld Posted January 4, 2008 Share Posted January 4, 2008 Yap, It kind a fun. My Anti virus does not detected any virus at all Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 4, 2008 Share Posted January 4, 2008 Okay much better. Anyways I really only promote open source projects. But glad to hear it's a good game. [center][/center] Link to comment Share on other sites More sharing options...
mads3n Posted January 4, 2008 Author Share Posted January 4, 2008 Okay much better. Anyways I really only promote open source projects. But glad to hear it's a good game.just got some internet for my laptop here in finland now sorry about that mate.. forgot to tell that the code is included in the zip file Mads3n.dk Link to comment Share on other sites More sharing options...
NewBe Posted January 4, 2008 Share Posted January 4, 2008 how come this is not working _Cheat1() Func _Cheat1() $Data = InputBox("Cheat Zap" , "Enter the score you want" , 999 , "" , 200 , 50) If Not @Error = 0 Then Exit ElseIf Not StringIsDigit($Data) Then MsgBox(0 , "Error" , "please only enter digits now exiting...") Exit Else Do WinWaitActive("ZAP" , "ZAP") Until @Error = 1 ControlSetText("ZAP" , "ZAP" , 2 , "Score: " & $Data) If @Error = 0 Then MsgBox(0 , "Error" , "no game found please run the game or error injecting the code") EndIf EndFunc I even had the control id set to 4 until the autoit info window told me that it was 2 Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 4, 2008 Share Posted January 4, 2008 (edited) The game may have a variable that holds the score. EDIT:I think I found an error..I didn't 'Get Zapped' when I moved over top of the bolt..look here... Edited January 4, 2008 by DBak [center][/center] Link to comment Share on other sites More sharing options...
NewBe Posted January 4, 2008 Share Posted January 4, 2008 (edited) The game may have a variable that holds the score.even if it does the control set data should override it Edited January 4, 2008 by NewBe Link to comment Share on other sites More sharing options...
mads3n Posted January 4, 2008 Author Share Posted January 4, 2008 (edited) The game may have a variable that holds the score. EDIT: I think I found an error.. I didn't 'Get Zapped' when I moved over top of the bolt.. look here... ah.. didnt even notice that.. Just cut if $LPOS1 = $PlayerCurPos and $step[1] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit elseif $LPOS2 = $PlayerCurPos and $step[2] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit Elseif $LPOS3 = $PlayerCurPos and $step[3] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit elseif $LPOS4 = $PlayerCurPos and $step[4] >= 10 Then MsgBox(0,"Zapped!","You got zapped! your scored "& $score& " Points!") Exit Endif in the bottom of the script.. updated the first post! the game now runs with levels.. and is much more fun to play Edited January 5, 2008 by mads3n Mads3n.dk Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 5, 2008 Share Posted January 5, 2008 I didn't look at the source but maybe it updates this text constanly or somthing... [center][/center] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now