use arrows to move, and space for gas pedal.. for you whipper snappers, you can change 1 lane when going fast, or 2 when going slow..
;dodge_ahk by Ton80 SetBatchLines, -1 #NoEnv #SingleInstance, Force CoordMode, Tooltip, Screen CoordMode, Pixel, Screen CoordMode, Mouse, Screen boardWidth := A_ScreenWidth, boardheight := A_ScreenHeight gosub, Initialize_Color_Values gosub, Initialize_Variables gosub, Initialize_Graphics gosub, Initialize_Board gosub, Initialize_Fuel gosub, Update_Screen gosub, Main_Loop return Main_Loop: Loop { Change_Delay_Player := A_TickCount - Car_Player_Last_Change_Lane Car_Player_Speed := Car_Player_Speed_Slow Loop, Parse, Player_1_Controls, csv If (GetKeyState(%A_Loopfield%, "P")) If (A_Loopfield = "Player_1_Up" or A_Loopfield = "Player_1_Down" or A_Loopfield = "Player_1_Left" or A_Loopfield = "Player_1_Right") && !(Change_Delay_Player > 500) continue else gosub, %A_LoopField% gosub, Car_Player_Move gosub, Car_Player_Offset gosub, Car_Computer_Move gosub, Car_Computer_Offset gosub, Update_Screen gosub, Car_Fuel_Collision gosub, Car_Player_Wall_Collision gosub, Car_Computer_Wall_Collision gosub, Car_Computer_Switch_Lanes gosub, Car_Car_Collision } return Player_1_Up: if (DllCall("RectInRegion", "Int", Vertical_Passage, "UInt", &ptCar_Player)) & !(Car_Player_Direction = 1) & !(Car_Player_Direction = 3) { If (Car_Player_Y > Boardheight / 2 ) { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane += 2 : car_player_lane +=1 gosub, Player_1_Check_Bounds Car_Player_Y := Lane%Car_Player_Lane%Y2 - Car_Height / 2 } else { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane -= 2 : car_player_lane -=1 gosub, Player_1_Check_Bounds Car_Player_Y := Lane%Car_Player_Lane%Y1 - Car_Height / 2 } gosub, Car_Player_Offset Car_Player_Last_Change_Lane := A_TickCount } return Player_1_Down: if (DllCall("RectInRegion", "Int", Vertical_Passage, "UInt", &ptCar_Player)) & !(Car_Player_Direction = 3) & !(Car_Player_Direction = 1) { If (Car_Player_Y > Boardheight / 2 ) { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane -= 2 : car_player_lane -=1 gosub, Player_1_Check_Bounds Car_Player_Y := Lane%Car_Player_Lane%Y2 - Car_Height / 2 } else { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane += 2 : car_player_lane +=1 gosub, Player_1_Check_Bounds Car_Player_Y := Lane%Car_Player_Lane%Y1 - Car_Height / 2 } gosub, Car_Player_Offset Car_Player_Last_Change_Lane := A_TickCount } return Player_1_Right: If (DllCall("RectInRegion", "Int", Horizontal_Passage, "UInt", &ptCar_Player)) & !(Car_Player_Direction = 2) & !(Car_Player_Direction = 4) { If (Car_Player_X > BoardWidth / 2 ) { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane -= 2 : car_player_lane -=1 gosub, Player_1_Check_Bounds Car_Player_X := Lane%Car_Player_Lane%X2 - Car_Height / 2 } else { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane += 2 : car_player_lane +=1 gosub, Player_1_Check_Bounds Car_Player_X := Lane%Car_Player_Lane%X1 - Car_Height / 2 } gosub, Car_Player_Offset Car_Player_Last_Change_Lane := A_TickCount } return Player_1_Left: If (DllCall("RectInRegion", "Int", Horizontal_Passage, "UInt", &ptCar_Player)) & !(Car_Player_Direction = 4) & !(Car_Player_Direction = 2) { If (Car_Player_X > BoardWidth / 2 ) { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane += 2 : car_player_lane +=1 gosub, Player_1_Check_Bounds Car_Player_X := Lane%Car_Player_Lane%X2 - Car_Height / 2 } else { car_Player_Lane := car_Player_speed = car_player_speed_slow ? car_player_lane -= 2 : car_player_lane -=1 gosub, Player_1_Check_Bounds Car_Player_X := Lane%Car_Player_Lane%X1 - Car_Height / 2 } gosub, Car_Player_Offset Car_Player_Last_Change_Lane := A_TickCount } return Player_1_Check_Bounds: Car_Player_Lane < 1 ? Car_Player_Lane := 1 : Car_Player_Lane > 4 ? Car_Player_Lane := 4 return Player_1_Fast: Car_Player_Speed := Car_Player_Speed_Fast return Car_Player_Move: Car_Player_Elapsed_Time := (A_TickCount - Car_Player_Last_Move_Time) / 1000 d := Car_Player_Direction = 1 ? Car_Player_Y -= Round(Car_Player_Speed * Car_Player_Elapsed_Time) : Car_Player_Direction = 2 ? Car_Player_X += Round(Car_Player_Speed * Car_Player_Elapsed_Time) : Car_Player_Direction = 3 ? Car_Player_Y += Round(Car_Player_Speed * Car_Player_Elapsed_Time) : Car_Player_Direction = 4 ? Car_Player_X -= Round(Car_Player_Speed * Car_Player_Elapsed_Time) d := return Car_Computer_Move: Car_Computer_Elapsed_Time := (A_TickCount - Car_Computer_Last_Move_Time) / 1000 d := Car_Computer_Direction = 1 ? Car_Computer_Y -= Round(Car_Computer_Speed * Car_Computer_Elapsed_Time) : Car_Computer_Direction = 2 ? Car_Computer_X += Round(Car_Computer_Speed * Car_Computer_Elapsed_Time) : Car_Computer_Direction = 3 ? Car_Computer_Y += Round(Car_Computer_Speed * Car_Computer_Elapsed_Time) : Car_Computer_Direction = 4 ? Car_Computer_X -= Round(Car_Computer_Speed * Car_Computer_Elapsed_Time) d := return Car_Player_Offset: Car_Player_x2:= Car_Player_X + Car_Width,Car_Player_Y2:= Car_Player_Y + Car_Height,Car_Player_Last_Move_Time:= A_TickCount NumPut(Car_Player_X, ptCar_Player, 0) NumPut(Car_Player_Y, ptCar_Player, 4) NumPut(Car_Player_X2, ptCar_Player, 8) NumPut(Car_Player_Y2, ptCar_Player, 12) return Car_Computer_Offset: Car_Computer_x2 := Car_Computer_X + Car_Width,Car_Computer_Y2 := Car_Computer_Y + Car_Height,Car_Computer_Last_Move_Time := A_TickCount NumPut(Car_Computer_X, ptCar_Computer, 0) NumPut(Car_Computer_Y, ptCar_Computer, 4) NumPut(Car_Computer_X2, ptCar_Computer, 8) NumPut(Car_Computer_Y2, ptCar_Computer, 12) return Car_Computer_Switch_Lanes: If (A_TickCount - Car_Computer_Last_Change_Lane < Car_Computer_Reaction_Time) return if (Car_Computer_Lane < Car_Player_Lane) { If (Car_Computer_Y < boardheight / 2) && (DllCall("RectInRegion", "Int", Vertical_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane ++,Car_Computer_Y:= Lane%Car_Computer_Lane%Y1 - Car_Height / 2,Car_Computer_Last_Change_Lane := A_TickCount Else If (Car_Computer_Y > boardheight / 2) && (DllCall("RectInRegion", "Int", Vertical_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane ++,Car_Computer_Y := Lane%Car_Computer_Lane%Y2 - Car_Height / 2,Car_Computer_Last_Change_Lane := A_TickCount Else If (Car_Computer_X < boardWidth / 2) && (DllCall("RectInRegion", "Int", Horizontal_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane ++,Car_Computer_X := Lane%Car_Computer_Lane%X1 - Car_Width / 2,Car_Computer_Last_Change_Lane := A_TickCount Else If (Car_Computer_X > boardWidth / 2) && (DllCall("RectInRegion", "Int", Horizontal_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane ++,Car_Computer_X := Lane%Car_Computer_Lane%X2 - Car_Width / 2,Car_Computer_Last_Change_Lane := A_TickCount Else return gosub, Car_Computer_Offset } Else if (Car_Computer_Lane > Car_Player_Lane) { If (Car_Computer_Y < boardheight / 2) && (DllCall("RectInRegion", "Int", Vertical_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane --,Car_Computer_Y := Lane%Car_Computer_Lane%Y1 - Car_Height / 2,Car_Computer_Last_Change_Lane := A_TickCount Else If (Car_Computer_Y > boardheight / 2) && (DllCall("RectInRegion", "Int", Vertical_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane --,Car_Computer_Y := Lane%Car_Computer_Lane%Y2 - Car_Height / 2,Car_Computer_Last_Change_Lane := A_TickCount Else If (Car_Computer_X < boardWidth / 2) && (DllCall("RectInRegion", "Int", Horizontal_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane --,Car_Computer_X := Lane%Car_Computer_Lane%X1 - Car_Width / 2,Car_Computer_Last_Change_Lane := A_TickCount Else If (Car_Computer_X > boardWidth / 2) && (DllCall("RectInRegion", "Int", Horizontal_Passage, "UInt", &ptCar_Computer)) Car_Computer_Lane --,Car_Computer_X := Lane%Car_Computer_Lane%X2 - Car_Width / 2,Car_Computer_Last_Change_Lane := A_TickCount Else return gosub, Car_Computer_Offset } return ;collisions Car_Car_Collision: if (DllCall("IntersectRect", "UInt", &ptCrash, "UInt", &ptCar_Player, "UInt", &ptCar_Computer)) { gosub, Screen_Flash_Crash Player_Lives -- If Player_Lives <= 0 gosub Game_Over else gosub, Reset_Board } return Car_Fuel_Collision: Loop, 128 { If DllCall("RectInRegion", "Int", Fuel_Pellet_%A_Index%, "Int", &ptCar_Player) { DllCall("DeleteObject", "Int", Fuel_Pellet_%A_Index%) Player_Score += Fuel_Points,Fuel_Pellets_Count -- If (Fuel_Pellets_Count = 0) { Computer_Skill < 5 ? Computer_Skill ++ : Computer_Skill := 5,Player_Score += 100 * Player_Level,Player_Level ++ gosub, Screen_Flash_Win gosub, Reset_Board } } } return Car_Player_Wall_Collision: If (Car_Player_Direction = 1) && (Car_Player_Y <= Lane%Car_Player_Lane%Y1 - Car_Width / 2) Car_Player_Direction := 4, Car_Player_Y := Lane%Car_Player_Lane%Y1 - Car_Width /2 Else If (Car_Player_Direction = 2) && (Car_Player_X >= Lane%Car_Player_Lane%X2 - Car_Width / 2) Car_Player_Direction := 1, Car_Player_X := Lane%Car_Player_Lane%X2 - Car_Width /2 Else If (Car_Player_Direction = 3) && (Car_Player_Y >= Lane%Car_Player_Lane%Y2 - Car_Width / 2) Car_Player_Direction := 2, Car_Player_Y := Lane%Car_Player_Lane%Y2 - Car_Width /2 Else If (Car_Player_Direction = 4) && (Car_Player_X <= Lane%Car_Player_Lane%X1 - Car_Width / 2) Car_Player_Direction := 3, Car_Player_X := Lane%Car_Player_Lane%X1 - Car_Width /2 return Car_Computer_Wall_Collision: If (Car_Computer_Direction = 1) && (Car_Computer_Y <= Lane%Car_Computer_Lane%Y1 - Car_Width / 2) Car_Computer_Direction := 2, Car_Computer_Y := Lane%Car_Computer_Lane%Y1 - Car_Width /2 Else If (Car_Computer_Direction = 2) && (Car_Computer_X >= Lane%Car_Computer_Lane%X2 - Car_Width / 2) Car_Computer_Direction := 3, Car_Computer_X := Lane%Car_Computer_Lane%X2 - Car_Width /2 Else If (Car_Computer_Direction = 3) && (Car_Computer_Y >= Lane%Car_Computer_Lane%Y2 - Car_Width / 2) Car_Computer_Direction := 4, Car_Computer_Y := Lane%Car_Computer_Lane%Y2 - Car_Width /2 Else If (Car_Computer_Direction = 4) && (Car_Computer_X <= Lane%Car_Computer_Lane%X1 - Car_Width / 2) Car_Computer_Direction := 1, Car_Computer_X := Lane%Car_Computer_Lane%X1 - Car_Width /2 return ;display game_over: MsgBox,0,Dodge AHK, % "GAME OVER" . "`r`n`r`nScore : " . Player_Score sleep, 3000 gosub, cleanup Reload return Reset_Board: Car_Computer_Reaction_Time := 2600 - (Computer_Skill * 500) sleep, 1000 gosub, initialize_fuel gosub, Car_Player_Offset gosub, Car_Computer_Offset Car_Player_X:= Car_Player_X_Start,Car_Player_Y:= Car_Player_Y_Start,Car_Player_Direction:= 2,Car_Player_Lane:= 1,Car_Player_Last_Move_Time := A_TickCount Car_Computer_X:= Car_Computer_X_Start,Car_Computer_Y:= Car_Computer_Y_Start,Car_Computer_Direction:= 4,Car_Computer_Lane:= 1,Car_Computer_Last_Move_Time:= A_TickCount return Score_Display: Lives_Display:= "Lives:" Player_Lives - 1,Level_Display:= "Level:" Player_Level DllCall("TextOut", "Int", hdcMem, "UInt", boardwidth * .1, "UInt", 0, "UInt", &Player_Score, "UInt", StrLen(Player_Score)) DllCall("TextOut", "Int", hdcMem, "UInt", boardwidth * .1, "UInt", boardheight * .92, "UInt", &Lives_Display, "UInt", StrLen(Lives_Display)) DllCall("TextOut", "Int", hdcMem, "UInt", BoardWidth *.6, "UInt", boardheight * .92, "UInt", &Level_Display, "UInt", StrLen(Level_Display)) return Update_Screen: gosub, draw_fuel gosub, Score_Display DllCall("FillRect", "Int", hdcMem, "UInt", &ptCar_Player, "int", brush_red) DllCall("FrameRect", "Int", hdcMem, "UInt", &ptCar_Player, "int", brush_yellow) DllCall("FillRect", "Int", hdcMem, "UInt", &ptCar_Computer, "int", brush_Blue) DllCall("FrameRect", "Int", hdcMem, "UInt", &ptCar_Computer, "int", brush_yellow) DllCall("FillRgn", "Int", HdcMem, "Int", Wall, "Int", Brush_Purple) DllCall("FillRgn", "Int", HdcMem, "Int", Car_Computer, "Int", Brush_blue) DllCall("FrameRgn", "Int", HdcMem, "Int", Car_Computer, "Int", Brush_yellow, "Int", 1, "Int", 1) DllCall("FrameRgn", "Int", HdcMem, "Int", Wall, "Int", Brush_Red, "Int", 2, "Int", 2) DllCall("BitBlt", "uint", hdcWin, "int", 0, "int", 0, "int", boardWidth, "int", boardHeight, "uint", hdcMem, "int", 0, "int", 0, "uint", 0xCC0020) DllCall("FillRect", "uint", hdcMem, "UInt", &ptWin, "uint", Brush_BackGround) return Screen_Flash_Crash: Loop, 30 { DllCall("FillRect", "Int", hdcMem, "Int", &ptWin, "Int", Brush_White) gosub, update_Screen sleep, 5 } return Screen_Flash_Win: Loop, 100 { DllCall("FillRect", "Int", hdcWin, "Int", &ptWin, "Int", Brush_White) gosub, update_Screen sleep, 5 } return ;setup Initialize_Color_Values: Green:= "0x008000",Silver:= "0xC0C0C0",Lime:= "0x00FF00",Gray:= "0x808080",Olive:= "0x008080", White:= "0xFFFFFF",Yellow:= "0x00FFFF",Maroon:= "0x000080",Navy:= "0x800000",Red := "0x0000FF",Blue:= "0xFF0000",Purple:= "0x800080",Teal:= "0x808000",Fuchsia:= "0xFF00FF",Aqua:= "0xFFFF00",Black:= "0x000000",Brown:= "0x2A2AA5",RGN_AND:= 1,RGN_COPY:= 5,RGN_DIFF:= 4,RGN_OR:= 2,RGN_XOR:= 3 return Initialize_Variables: Track_width_feet:= 53,Track_height_feet:= 27,Feet_per_pixel := Track_width_feet / boardwidth Car_Player_Speed_Slow := 20,Car_Player_Speed_Fast := 45,Car_Player_Speed_Slow /= feet_per_pixel,Car_Player_Speed_Fast /= feet_per_pixel,Car_Player_Speed := Car_Player_Speed_Slow Car_Height := boardHeight * .056,Car_Width := boardHeight * .056 Car_Player_X_Start:= boardWidth * .552,Car_Player_Y_Start:= boardHeight * .838,Car_Player_X := Car_Player_X_Start,Car_Player_Y:= Car_Player_Y_Start,Car_Player_Direction:= 2,Car_Player_Lane:= 1,Player_Level:= 1 VarSetCapacity(ptCar_Player, 16,0) VarSetCapacity(ptCrash, 16,0) VarSetCapacity(ptCar_Computer, 16,0) gosub, car_player_offset Player_Lives:= 5,Player_Score:= 0,Fuel_Points:= 10 Player_1_Right:= "Right",Player_1_Left:= "Left",Player_1_Down:= "Down",Player_1_Up:= "Up",Player_1_Fast:= "Space",Toggle_Frame_Rate:= "F1" Player_1_Controls := "Player_1_Fast,Player_1_Right,Player_1_Left,Player_1_Down,Player_1_Up,Toggle_Frame_Rate" Car_Computer_Speed:= 30,Car_Computer_Speed /= feet_per_pixel,Car_Computer_X_Start:= boardwidth * .418,Car_Computer_Y_Start:= boardheight * .838,Car_Computer_X:= Car_Computer_X_Start,Car_Computer_Y:= Car_Computer_Y_Start,Car_Computer_Direction:= 4,Car_Computer_Lane:= 1,Car_Computer_Reaction_Time:= 2000,Computer_Skill:= 1,Fuel_Pellet_Size:= boardwidth * .01 gosub,car_computer_offset Lane1X1 := boardwidth * .039,Lane1X2 := boardwidth * .961,Lane1Y1 := boardheight * .139,Lane1Y2 := boardheight * .861 Lane2X1 := boardwidth * .102,Lane2X2 := boardWidth * .898,Lane2Y1 := boardheight * .222,Lane2Y2 := boardheight * .778 Lane3X1 := boardWidth * .164,Lane3X2 := boardWidth * .836,Lane3Y1 := boardheight * .306,Lane3Y2 := boardheight * .694 Lane4X1 := boardWidth * .227,Lane4X2 := boardWidth * .773,Lane4Y1 := boardheight * .389,Lane4Y2 := boardheight * .611 Car_Player_Elapsed_Time := 0, Car_Player_Last_Move_Time := A_TickCount,Car_Player_Last_Change_Lane := A_TickCount,Car_Computer_Last_Change_Lane := A_TickCount,Car_Computer_Last_Move_Time := A_TickCount return Initialize_Graphics: VarSetCapacity(ptWin, 16, 0) NumPut(boardWidth, ptWin, 8) , NumPut(boardHeight, ptWin, 12) gui,1: color, black gui,show, h%BoardHeight% w%BoardWidth% x-3 y-22 hdcWin := DllCall("GetDC", "UInt", hwnd:=WinExist("A")),hdcMem := DllCall("CreateCompatibleDC", "UInt", hdcWin),hbm := DllCall("CreateCompatibleBitmap", "uint", hdcWin, "int", boardWidth, "int", boardHeight), Pen := DllCall("CreatePen", "UInt", 0, "UInt", 6, "UInt", Green) DllCall("SelectObject", "uint", hdcMem, "uint", hbm) DllCall("SelectObject","UInt", hdcMem, "UInt", Pen) DllCall("SelectObject","UInt", hdcWin, "UInt", Pen) Brush_BackGround:= DllCall("CreateSolidBrush", "Int", Black),Brush_Red:= DllCall("CreateSolidBrush", "Int", Red),Brush_Green:= DllCall("CreateSolidBrush", "Int", Green),Brush_Blue:= DllCall("CreateSolidBrush", "Int", Blue),Brush_Maroon:= DllCall("CreateSolidBrush", "Int", Maroon),Brush_Purple:= DllCall("CreateSolidBrush", "Int", Purple),Brush_Yellow:= DllCall("CreateSolidBrush", "Int", Yellow),font_width:= boardwidth * .05,font_height:= boardheight *.06,hFont:=DllCall("CreateFont", "int", font_width, "int",font_height, "int", 0, "int", 0, "int", 1000 ,"uint",0,"uint",0,"uint",0,"uint",1,"uint",0,"uint",0,"uint",0,"uint",0,"str", "Comic Sans MS Bold") DllCall("SelectObject", "uint", hdcMem, "uint", hFont) DllCall("SetBkColor", "Int", hdcMem, "Int", black) DllCall("SetTextColor", "Int", hdcMem, "Int", green) return Initialize_Board: Wall:= DllCall("CreateRectRgn", "Int", 0, "Int", boardheight * .09, "Int", boardwidth, "Int", boardheight * .91),Wall2:= DllCall("CreateRectRgn", "Int", boardwidth * .015, "Int", boardheight * .1, "Int", boardwidth *.985, "Int", boardheight *.9) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Wall2, "Int", rgn_diff) DllCall("DeleteObject", "Int", Wall2) DllCall("DeleteObject", "Int", Wall2) Wall2:= DllCall("CreateRectRgn", "Int", boardwidth *.0625, "Int", boardheight *.176, "Int", boardwidth * .938, "Int", boardheight *.824),Wall3 := DllCall("CreateRectRgn", "Int", boardwidth *.0781, "Int", boardheight *.185, "Int", boardwidth * .922, "Int", boardheight *.815) DllCall("CombineRgn", "Int", Wall2, "Int", Wall2, "Int", Wall3, "Int", rgn_xor) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Wall2, "Int", rgn_xor) DllCall("DeleteObject", "Int", Wall2) DllCall("DeleteObject", "Int", Wall3) Wall2:= DllCall("CreateRectRgn", "Int", boardwidth * .125, "Int", boardheight * .259, "Int", boardwidth *.875, "Int", boardheight * .741),Wall3 := DllCall("CreateRectRgn", "Int", boardwidth * .141, "Int", boardheight * .269, "Int", boardwidth *.859, "Int", boardheight * .731) DllCall("CombineRgn", "Int", Wall2, "Int", Wall2, "Int", Wall3, "Int", rgn_xor) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Wall2, "Int", rgn_xor) DllCall("DeleteObject", "Int", Wall2) DllCall("DeleteObject", "Int", Wall3) Wall2:= DllCall("CreateRectRgn", "Int", boardwidth * .188, "Int", boardheight * .343, "Int", boardwidth * .813, "Int", boardheight * .657),Wall3 := DllCall("CreateRectRgn", "Int", boardwidth * .203, "Int", boardheight * .352, "Int", boardwidth * .797, "Int", boardheight * .648) DllCall("CombineRgn", "Int", Wall2, "Int", Wall2, "Int", Wall3, "Int", rgn_xor) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Wall2, "Int", rgn_xor) DllCall("DeleteObject", "Int", Wall2) DllCall("DeleteObject", "Int", Wall3) Vertical_Passage:= DllCall("CreateRectRgn", "Int", boardwidth * .448, "Int", 0, "Int", boardwidth * .552, "Int", boardheight) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Vertical_Passage, "Int", rgn_diff) DllCall("DeleteObject", "Int", Vertical_Passage) Vertical_Passage:= DllCall("CreateRectRgn", "Int", boardwidth / 2 - car_width / 2, "Int", 0, "Int", boardwidth / 2 + car_width / 2, "Int", boardheight), Horizontal_Passage := DllCall("CreateRectRgn", "Int", 0, "Int", boardHeight *.407, "Int", boardwidth, "Int", boardheight * .593) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Horizontal_Passage, "Int", rgn_diff) DllCall("DeleteObject", "Int", Horizontal_Passage) Horizontal_Passage := DllCall("CreateRectRgn", "Int", 0, "Int", boardHeight / 2 - car_height / 2, "Int", boardwidth, "Int", boardheight / 2 + car_height / 2),Wall2 := DllCall("CreateRectRgn", "Int", boardwidth * .250, "Int", boardheight * .426, "Int", boardwidth * .750, "Int", boardheight * .574),Wall3 := DllCall("CreateRectRgn", "Int", boardwidth * .266, "Int", boardheight * .435, "Int", boardwidth * .734, "Int", boardheight * .565) DllCall("CombineRgn", "Int", Wall2, "Int", Wall2, "Int", Wall3, "Int", rgn_xor) DllCall("CombineRgn", "Int", Wall, "Int", Wall, "Int", Wall2, "Int", rgn_xor) DllCall("DeleteObject", "Int", Wall2) DllCall("DeleteObject", "Int", Wall3) return Draw_Fuel: Loop, 128 { DllCall("FillRgn", "Int", hdcMem, "Int", Fuel_Pellet_%A_Index%, "Int", brush_yellow) if (fuel_pellet_size > 5) DllCall("FrameRgn", "Int", hdcMem, "Int", Fuel_Pellet_%A_Index%, "Int", brush_maroon, "Int", 2, "Int", 2) } return Initialize_Fuel: Fuel_X1:= Lane1X1,Fuel_X2:= Lane1X2,Fuel_Space:= (Fuel_X2 - Fuel_X1) / 15.2,,Pellet_Number:= 1 Loop, 2 { Ypos := A_Index Loop, 4 { Fuel_Y := Lane%A_Index%Y%Ypos% - (Fuel_Pellet_Size / 2) Loop, 16 Fuel_Pellet_%Pellet_Number% := DllCall("CreateEllipticRgn", "Int", Fuel_X1, "Int", Fuel_Y, "Int", Fuel_X1 + Fuel_Pellet_Size, "Int", Fuel_Y + Fuel_Pellet_Size), Fuel_X1 += Fuel_Space,Pellet_Number ++ Fuel_X1 := Lane1X1 } } dPellet = 8,9,24,25,40,41,56,57,72,73,88,89,104,105,120,121 Loop, parse, dpellet, csv DllCall("DeleteObject", "Int", Fuel_Pellet_%A_Loopfield%) Fuel_Pellets_Count := 112 return GuiClose: esc:: OnExit gosub, Cleanup exitapp cleanup: objects = Wall,Vertical_Passage,Horizontal_Passage,Pen,Brush_BackGround,Brush_Red,Brush_Green,Brush_Blue,Brush_Maroon,Brush_Purple,Brush_Yellow,hbm loop, parse, objects, csv DllCall("DeleteObject", "Int", %A_Loopfield%) DllCall("ReleaseDC", uint, hdcWin) DllCall("ReleaseDC", uint, hdcMem) Loop, 128 DllCall("DeleteObject", "Int", Fuel_Pellet_%A_Index%) return
edit : cleaned up code, shortend by almost 300 lines..