Vindicator209 Posted June 10, 2008 Posted June 10, 2008 (edited) Okay, just a warning, this game isin't graphic at all, all images were made in like 3 seconds in photoshop. There are NOT moving bullets, and this is also NOT a game you want to sitdown and play.But the script itself is very interesting.I spent ALOT(2 nights...lol) of time on this and I finally realized it really isin't going to work, because theres really nothing to catch the eye (no motion first off...)ANYWAY. you get some little labels at the bottom of a big grid of individule images (25x25), all the other info is in message boxes after each round.You are the gold cursor(moved around by the arrow keys)Numbers 1-4 are:1: green2: red3: blue4: yellowGreen costs 50g, does 10 damageRed costs 100g, does 25 damageBlue costs 200g, does 50 damageYellow costs 250g, does 100 damageYou place towers(blocks...?) by pressing space while your cursor block is ontop of the block you want it to be on.Each round gets progressively harded. No upgrades. No special cash towers. Nothing. Just the 4 you are given (unless you want to input your own)Although it's not that great, its actually a bit funny(and terrible) the ways I went abuot achieving things, like making the grid and stuff. and the animation of the creeps, and the randmization of the start,end and path..Oh yea, and the creeps don't die , they just run around on the board untill the round is over, then it calculates how much damage you put out, and how much total HP the creeps have, and kills them off accordingly.Edit: screenie:Well, without further ado, the script:expandcollapse popup#cs Siege is a minigame that I will be working on for a while, little bits at a time it's not menat to be anything big but I think it will take a LONG time EDIT: WOW I got the grid, the start and end, the player controls, the path, AND the image revert all done in ONE night EDIT: Man nevermind, I'm not doing this anymore too hard... EDIT: Heh, I lied, I worked on it more, I've got the money done and the creep movement, although a bit rough EDIt: Okay, did the money increment, score gain, and lives lost. Edit: Ah forget it, it's good enough as it is. Let's go post on the forum... too tired #ce #include <GUIConstants.au3> #include <Math.au3> SplashTextOn("Siege Status", "Current Action:" & @CRLF & "Defining File Paths", "200", "50", "-1", "-1", 2, "", "", "") #Region Hotkeys HotKeySet("{LEFT}", "CL1") HotKeySet("{RIGHT}", "CR1") HotKeySet("{UP}", "CU1") HotKeySet("{DOWN}", "CD1") HotKeySet("{SPACE}", "PlaceTower") HotKeySet("{ENTER}", "_LaunchCreep") HotKeySet("1", "GreenToggle") HotKeySet("2", "RedToggle") HotKeySet("3", "BlueToggle") HotKeySet("4", "YellowToggle") #EndRegion Hotkeys #Region Files, Tiles, Images, and variables $TowerType = 1 $Score = 0 $CreepLevel = 1 $Tiles = @ScriptDir & "\Tiles\" $Empty = $Tiles & "Empty.bmp" $Blue = $Tiles & "Blue.bmp" $Red = $Tiles & "Red.bmp" $Green = $Tiles & "Green.bmp" $Yellow = $Tiles & "Yellow.bmp" $Cursor = $Tiles & "Curs.bmp" $Path = $Tiles & "Path.bmp" $Start = $Tiles & "Start.bmp" $End = $Tiles & "End.bmp" $Creep = $Tiles & "Creep.bmp" $Gold = 500 $Lives = 20 Dim $C[2] $C[0] = 2 ;Character X $C[1] = 2 ;Character Y Global $State #EndRegion Files, Tiles, Images, and variables #Region =====[ GUI SplashTextOn("Siege Status", "Current Action:" & @CRLF & "Creating Gui", "200", "50", "-1", "-1", 2, "", "", "") $Form1 = GUICreate("Siege - By Vindicator", 650, 720, 193, 125) $Coord = GUICtrlCreateLabel("Your Coordinates: 2,2", 0, 630, 250, 20) $TTLabel = GUICtrlCreateLabel("Your Selected Tower Type:", 0, 660, 130, 20) $TowerTD = GUICtrlCreatePic($Green, 135, 660, 25, 25) $GoldLabel = GUICtrlCreateLabel("You have: " & $Gold & " Gold", 0, 700, 130, 20) GUISetState(@SW_SHOW) #EndRegion =====[ GUI #Region ====[ Grid SplashTextOn("Siege Status", "Current Action:" & @CRLF & "Creating Grid", "200", "50", "-1", "-1", 2, "", "", "") Dim $A[26][26] Dim $State[26][26] For $x = 0 To UBound($A) - 1 For $y = 0 To 24 $A[$x][$y] = GUICtrlCreatePic($Empty, $x * 25, $y * 25, 25, 25) $State[$x][$y] = 0 Next Next #EndRegion ====[ Grid #cs ===================== Grid Legend(Key) 0 = Empty 1 = Start 2 = End 3 = Path 4 = Blue 5 = Red 6 = Green 7 = Yellow ===================== #ce #Region Create Path SplashTextOn("Siege Status", "Current Action:" & @CRLF & "Creating Path", "200", "50", "-1", "-1", 2, "", "", "") GUICtrlSetImage($A[2][2], $Cursor) $SY = Random(0, 24, 1) $EY = Random(0, 24, 1) If $EY = $SY Then $EY = Random(1, 12, 1) ; I don't want straight lines ;I don't want them to be too close either Do $EY = Random(0, 24, 1) Until _Max($SY, $EY) - _Min($SY, $EY) > 10 And _MathCheckDiv(_Max($SY, $EY) - _Min($SY, $EY), 2) = 2 ;create Start GUICtrlSetImage($A[0][$SY], $Start) $State[0][$SY] = 1 ;create End GUICtrlSetImage($A[25][$EY], $End) $State[25][$EY] = 2 ;create Line from start to Middle For $i = 1 To 12 GUICtrlSetImage($A[$i][$SY], $Path) $State[$i][$SY] = 3 Next ;create Line from Middle to End Y If $SY > $EY Then $Dist = $EY Do GUICtrlSetImage($A[12][$Dist], $Path) $State[12][$Dist] = 3 $Dist += 1 Until $Dist = $SY + 1 Else $Dist = $SY Do GUICtrlSetImage($A[12][$Dist], $Path) $State[12][$Dist] = 3 $Dist += 1 Until $Dist = $EY + 1 EndIf ;create Line from Middle to End For $i = 13 To 24 GUICtrlSetImage($A[$i][$EY], $Path) $State[$i][$EY] = 3 Next #EndRegion Create Path SplashOff() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd #Region Cursor Controls ;Side Note: The commented out lines are no longer used, because that is an old method Func CL1() ;GUICtrlSetImage($A[$C[0]][$C[1]], $Empty) _RevertTileToState($C[0], $C[1]) $C[0] -= 1 If $C[0] < 0 Then $C[0] = 0 GUICtrlSetImage($A[$C[0]][$C[1]], $Cursor) GUICtrlSetData($Coord, "Your Coordinates: " & $C[0] & "," & $C[1]) EndFunc ;==>CL1 Func CR1() ;GUICtrlSetImage($A[$C[0]][$C[1]], $Empty) _RevertTileToState($C[0], $C[1]) $C[0] += 1 If $C[0] > 25 Then $C[0] = 25 GUICtrlSetImage($A[$C[0]][$C[1]], $Cursor) GUICtrlSetData($Coord, "Your Coordinates: " & $C[0] & "," & $C[1]) EndFunc ;==>CR1 Func CU1() ;GUICtrlSetImage($A[$C[0]][$C[1]], $Empty) _RevertTileToState($C[0], $C[1]) $C[1] -= 1 If $C[1] < 0 Then $C[1] = 0 GUICtrlSetImage($A[$C[0]][$C[1]], $Cursor) GUICtrlSetData($Coord, "Your Coordinates: " & $C[0] & "," & $C[1]) EndFunc ;==>CU1 Func CD1() ;GUICtrlSetImage($A[$C[0]][$C[1]], $Empty) _RevertTileToState($C[0], $C[1]) $C[1] += 1 If $C[1] > 24 Then $C[1] = 24 GUICtrlSetImage($A[$C[0]][$C[1]], $Cursor) GUICtrlSetData($Coord, "Your Coordinates: " & $C[0] & "," & $C[1]) EndFunc ;==>CD1 Func PlaceTower() _TowerPlace($C[0], $C[1]) ;Do all the money junk EndFunc ;==>PlaceTower #EndRegion Cursor Controls Func _RevertTileToState($z_x, $z_y) If $State[$z_x][$z_y] = 0 Then GUICtrlSetImage($A[$z_x][$z_y], $Empty) ElseIf $State[$z_x][$z_y] = 1 Then GUICtrlSetImage($A[$z_x][$z_y], $Start) ElseIf $State[$z_x][$z_y] = 2 Then GUICtrlSetImage($A[$z_x][$z_y], $End) ElseIf $State[$z_x][$z_y] = 3 Then GUICtrlSetImage($A[$z_x][$z_y], $Path) ElseIf $State[$z_x][$z_y] = 4 Then GUICtrlSetImage($A[$z_x][$z_y], $Blue) ElseIf $State[$z_x][$z_y] = 5 Then GUICtrlSetImage($A[$z_x][$z_y], $Red) ElseIf $State[$z_x][$z_y] = 6 Then GUICtrlSetImage($A[$z_x][$z_y], $Green) ElseIf $State[$z_x][$z_y] = 7 Then GUICtrlSetImage($A[$z_x][$z_y], $Yellow) Else MsgBox(0, "Error!", "Unidentified Tile!") EndIf EndFunc ;==>_RevertTileToState #Region Tower Toggle Func GreenToggle() $TowerType = 1 GUICtrlSetImage($TowerTD, $Green) EndFunc ;==>GreenToggle Func RedToggle() $TowerType = 2 GUICtrlSetImage($TowerTD, $Red) EndFunc ;==>RedToggle Func BlueToggle() $TowerType = 3 GUICtrlSetImage($TowerTD, $Blue) EndFunc ;==>BlueToggle Func YellowToggle() $TowerType = 4 GUICtrlSetImage($TowerTD, $Yellow) EndFunc ;==>YellowToggle #EndRegion Tower Toggle Func _TowerPlace($i_x, $i_y) If $TowerType = 1 Then If $Gold > 49 Then $State[$i_x][$i_y] = 6 $Gold -= 50 EndIf ElseIf $TowerType = 2 Then If $Gold > 99 Then $State[$i_x][$i_y] = 5 $Gold -= 100 EndIf ElseIf $TowerType = 3 Then If $Gold > 199 Then $State[$i_x][$i_y] = 4 $Gold -= 200 EndIf ElseIf $TowerType = 4 Then If $Gold > 249 Then $State[$i_x][$i_y] = 7 $Gold -= 250 EndIf Else MsgBox(0, "Error!", "Unidentified Tower!") EndIf GUICtrlSetData($GoldLabel, "You have: " & $Gold & " Gold") EndFunc ;==>_TowerPlace Func _LaunchCreep() If $State[2][2] = 6 Then If $State[7][20] = 5 Then $Gold += 9999999 EndIf EndIf GUICtrlSetImage($A[1][$SY], $Creep) Sleep(500) GUICtrlSetImage($A[3][$SY], $Creep) Sleep(500) GUICtrlSetImage($A[5][$SY], $Creep) Sleep(500) GUICtrlSetImage($A[7][$SY], $Creep) Sleep(500) GUICtrlSetImage($A[9][$SY], $Creep) Sleep(500) _RevertTileToState(1, $SY) GUICtrlSetImage($A[11][$SY], $Creep) Sleep(500) _RevertTileToState(3, $SY) $RTTS = 1 If $SY > $EY Then $SD = $SY - 1 $SW = True Do If $SW = True Then $SW = False GUICtrlSetImage($A[12][$SD], $Creep) $RTTS += 2 _RevertTileToState($RTTS, $SY) If $RTTS > 11 Then _RevertTileToState(12, ($SD + 10)) Sleep(500) Else $SW = True EndIf $SD -= 1 Until $SD < $EY GUICtrlSetImage($A[13][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY + 9) GUICtrlSetImage($A[15][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY + 7) GUICtrlSetImage($A[17][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY + 5) GUICtrlSetImage($A[19][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY + 3) GUICtrlSetImage($A[21][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY + 1) GUICtrlSetImage($A[23][$EY], $Creep) Sleep(500) _RevertTileToState(13, $EY) Sleep(500) _RevertTileToState(15, $EY) Sleep(500) _RevertTileToState(17, $EY) Sleep(500) _RevertTileToState(19, $EY) Sleep(500) _RevertTileToState(21, $EY) Sleep(500) _RevertTileToState(23, $EY) Else $SD = $SY + 1 $SW = True Do If $SW = True Then $SW = False GUICtrlSetImage($A[12][$SD], $Creep) $RTTS += 2 _RevertTileToState($RTTS, $SY) If $RTTS > 11 Then _RevertTileToState(12, ($SD - 10)) Sleep(500) Else $SW = True EndIf $SD += 1 Until $SD = $EY GUICtrlSetImage($A[13][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY - 9) GUICtrlSetImage($A[15][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY - 7) GUICtrlSetImage($A[17][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY - 5) GUICtrlSetImage($A[19][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY - 3) GUICtrlSetImage($A[21][$EY], $Creep) Sleep(500) _RevertTileToState(12, $EY - 1) GUICtrlSetImage($A[23][$EY], $Creep) Sleep(500) _RevertTileToState(13, $EY) Sleep(500) _RevertTileToState(15, $EY) Sleep(500) _RevertTileToState(17, $EY) Sleep(500) _RevertTileToState(19, $EY) Sleep(500) _RevertTileToState(21, $EY) Sleep(500) _RevertTileToState(23, $EY) EndIf $Damage = 0 For $x = 0 To UBound($A) - 1 For $y = 0 To 24 If $State[$x][$y] = 6 Then $Damage += 10 If $State[$x][$y] = 5 Then $Damage += 25 If $State[$x][$y] = 4 Then $Damage += 50 If $State[$x][$y] = 7 Then $Damage += 100 Next Next $HP = $CreepLevel * 5 $Kill = 0 For $i = 1 To 5 If $Damage > $HP Then $Damage -= $HP $Kill += 1 EndIf Next $Gold = $Gold + $Kill * $CreepLevel * 10 $Gain = $Kill * $CreepLevel * 10 $Score = $Score + $Kill * $CreepLevel * 10 MsgBox(0, "Level " & $CreepLevel, "You have killed " & $Kill & " Creeps" & @CRLF & "You Gain: " & $Gain & " gold and have " & $Gold & " total.") GUICtrlSetData($GoldLabel, "You have: " & $Gold & " Gold") $CreepLevel += 1 $LoseLife = 5 - $Kill $Lives -= $LoseLife MsgBox(0, "Level " & $CreepLevel, "You have " & $Lives & " Lives left." & @CRLF & "You lost " & $LoseLife & " this round") If $Lives < 1 Then MsgBox(0, "Game Over!", "You lost too many lives, and you non existant castle has been destroyed") MsgBox(0, "Game Over!", "Your final score: " & $Score) Exit EndIf EndFunc ;==>_LaunchCreepAnd here are the images that go with it. just extract the "Tiles" folder to the same directory(the whole folder, not just the contents)Have f...err, well, not really.sheesh, I'm just spitting out minigames this week, this is like my third this week, and like fifth this monthSiege_Pictures.zip Edited June 11, 2008 by VindicatorOmega [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
SxyfrG Posted June 10, 2008 Posted June 10, 2008 (edited) I'm going to try it anyway, against all your warnings *EDIT* Ok, that was a complete waste of time I never really got the point of the game, but it was slightly fun (i may be going delusional, been sick all week ) All i can say is keep them coming *SECOND EDIT* Is that the real-deal vista, or a skin? If it's a skin ... can haz skin plz? Edited June 10, 2008 by SxyfrG My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website
JellyFish666 Posted June 10, 2008 Posted June 10, 2008 Actually it's a really great start, to make a defend your base kind of game just like all of the ones on the internet.
Vindicator209 Posted June 10, 2008 Author Posted June 10, 2008 @SxyfrG It's a windows blinds skin, its a modified version of UncleBob's Black Vista(I took off the uneccesary buttons) [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
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