AutoITphil Posted December 5, 2010 Share Posted December 5, 2010 Hello everyone. I have recently made a simple GDI that is like a small world. There is a person you can move around with the arrow keys. There is a dog who you can move with the WASD keys. And there is also a christmas tree. But my christmas tree doesn't do anything. So I was hoping to put some flashing red, green, and blue lights on the tree. I think I know how to embed the _gdiplus_pencreate function into the loops to do this, but I am at a loss when it comes to figuring out what to type in to get the color I'm looking for. Under the help file, for the parameters, it says Alpha, Red, Green, and Blue components of pen color. But I am not sure what the Alpha, Red, Green, and Blue components of the pen color are. Any assistance will be greatly. Thank You. And here is the code I'm trying to get this for: expandcollapse popup#include <WindowsConstants.au3> #include <WinAPI.au3> #Include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <misc.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $hGraphic, $hGUI, $hPen, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $w, $h Global $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $headX, $headY, $headWID, $headHEI, $redraw = 0, $hBitmap, $hBuffer Global $block, $blockX, $blockY, $blockWID, $blockHEI, $jump, $jump2, $ground, $groundX1, $groundX2, $groundY1, $groundY2 Global $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI Global $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $DheadX, $DheadY, $DheadWID, $DheadHEI Global $treebaseX, $treebaseY, $treebaseWID, $treebaseHEI, $treeBOTX1, $treeBOTY1, $treeBOTX2, $treeBOTY2, $treeSID1X1, $treeSID1Y1, $treeSID1X2, $treeSID1Y2 Global $treeSID2X1, $treeSID2Y1, $treeSID2X2, $treeSID2Y2, $treeSID3X1, $treeSID3Y1, $treeSID3X2, $treeSID3Y2, $treeSID4X1, $treeSID4Y1 Global $treeSID4X2, $treeSID4Y2, $treeSID5X1, $treeSID5Y1, $treeSID5X2, $treeSID5Y2, $treeSID6X1, $treeSID6Y1, $treeSID6X2, $treeSID6Y2 Global $treeSID7X1, $treeSID7Y1, $treeSID7X2, $treeSID7Y2, $treeSID8X1, $treeSID8Y1, $treeSID8X2, $treeSID8Y2, $treeSID9X1, $treeSID9Y1 Global $treeSID9X2, $treeSID9Y2, $treeSID10X1, $treeSID10Y1, $treeSID10X2, $treeSID10Y2, $treeSID11X1, $treeSID11Y1, $treeSID11X2, $treeSID11Y2 Global $treeSID12X1, $treeSID12Y1, $treeSID12X2, $treeSID12Y2, $treeSID13X1, $treeSID13Y1, $treeSID13X2, $treeSID13Y2 Global $treeSID14X1, $treeSID14Y1, $treeSID14X2, $treeSID14Y2, $treeMID $w = @DesktopWidth $h = @DesktopHeight main() func main() Local $msg = 0 $leg1X1 = @desktopwidth/2 $leg1Y1 = @desktopheight-300 $leg1X2 = $leg1X1 - 30 $leg1y2 = $leg1Y1 + 80 $leg2X1 = $leg1X1 $leg2Y1 = $leg1Y1 $leg2X2 = $leg2x1 + 30 $leg2Y2 = $leg2Y1 + 80 $bodyX1 = $leg1X1 $bodyY1 = $leg1Y1 $bodyX2 = $leg1X1 $bodyY2 = $leg1Y1 - 100 $arm1X1 = $leg1X1 $arm1Y1 = $bodyY2 $arm1X2 = $leg1X1 - 75 $arm1Y2 = $arm1Y1 + 25 $arm2X1 = $leg1X1 $arm2Y1 = $arm1Y1 $arm2X2 = $leg1X1 + 75 $arm2Y2 = $arm1Y1 + 25 $headX = $bodyX2 - 20 $headY = $bodyY2 - 40 $headWID= 40 $headHEI= 40 $Dleg1X1 = @desktopwidth/2-300 $Dleg1Y1 = @DesktopHeight - 240 $Dleg1X2 = $Dleg1X1 - 15 $Dleg1Y2 = $Dleg1Y1 + 20 $Dleg2X1 = $Dleg1X1 + 7 $Dleg2Y1 = $Dleg1Y1 $Dleg2X2 = $Dleg2X1 $Dleg2Y2 = $Dleg2Y1 + 20 $DbodyX = $Dleg1X1 - 15 $DbodyY = $Dleg1Y1 - 30 $DbodyWID = 70 $DbodyHEI = 30 $Dleg3X1 = $Dleg2X1 + 15 $Dleg3Y1 = $Dleg1Y1 $Dleg3X2 = $Dleg3X1 $Dleg3Y2 = $Dleg3Y1 + 20 $Dleg4X1 = $Dleg3X1 + 7 $Dleg4Y1 = $Dleg1Y1 $Dleg4X2 = $Dleg4X1 + 15 $Dleg4Y2 = $Dleg4Y1 + 20 $DheadX = $DbodyX + 65 $DheadY = $DbodyY - 5 $DheadWID= 18 $DheadHEI= 13 $blockX = 600 $blockY = @DesktopHeight-270 $blockHEI = 50 $blockWID = 150 $jump = 0 $jump2 = 0 $groundX1 = 0 $groundY1 = @DesktopHeight-220 $groundX2 = @DesktopWidth $groundY2 = @DesktopHeight-220 $treeMID = 675 $treebaseX = 660 $treebaseY = @DesktopHeight-295 $treebaseHEI = 25 $treebaseWID = 30 $treeBOTX1 = $treeMID-100 $treeBOTY1 = $treebaseY $treeBOTX2 = $treeMID+100 $treeBOTY2 = $treebaseY $treeSID1X1 = $treeBOTX2 $treeSID1Y1 = $treeBOTY2 $treeSID1X2 = $treeMID+25 $treeSID1Y2 = $treeBOTY2-40 $treeSID2X1 = $treeBOTX1 $treeSID2Y1 = $treeBOTY1 $treeSID2X2 = $treemid-25 $treeSID2Y2 = $treeBOTY1-40 $treeSID3X1 = $treeSID1X2 $treeSID3Y1 = $treeSID1Y2 $treeSID3X2 = $treeSID1X1-10 $treeSID3Y2 = $treeSID1Y1-30 $treeSID4X1 = $treeSID2X2 $treeSID4Y1 = $treeSID2Y2 $treeSID4X2 = $treesid2X1+10 $treeSID4Y2 = $treeSID2Y1-35 $treeSID5X1 = $treeSID3X2 $treeSID5Y1 = $treeSID3Y2 $treeSID5X2 = $treeSID3X1-10 $treeSID5Y2 = $treeSID3Y1-40 $treeSID6X1 = $treeSID4X2 $treeSID6Y1 = $treeSID4Y2 $treeSID6X2 = $treeSID4X1+10 $treeSID6Y2 = $treeSID4Y1-40 $treeSID7X1 = $treeSID5X2 $treeSID7Y1 = $treeSID5Y2 $treeSID7X2 = $treeSID5X1-10 $treeSID7Y2 = $treeSID5Y1-40 $treeSID8X1 = $treeSID6X2 $treeSID8Y1 = $treeSID6Y2 $treeSID8X2 = $treeSID6X1+10 $treeSID8Y2 = $treeSID6Y1-40 $treeSID9X1 = $treeSID7X2 $treeSID9Y1 = $treeSID7Y2 $treeSID9X2 = $treeSID7X1-5 $treeSID9Y2 = $treeSID7Y1-40 $treeSID10X1 = $treeSID8X2 $treeSID10Y1 = $treeSID8Y2 $treeSID10X2 = $treeSID8X1+5 $treeSID10Y2 = $treeSID8Y1-40 $treeSID11X1 = $treeSID9X2 $treeSID11Y1 = $treeSID9Y2 $treeSID11X2 = $treeSID9X1-10 $treeSID11Y2 = $treeSID9Y1-40 $treeSID12X1 = $treeSID10X2 $treeSID12Y1 = $treeSID10Y2 $treeSID12X2 = $treeSID10X1+10 $treeSID12Y2 = $treeSID10Y1-40 $treeSID13X1 = $treeSID11X2 $treeSID13Y1 = $treeSID11Y2 $treeSID13X2 = $treeSID11X1-10 $treeSID13Y2 = $treeSID11Y1-40 $treeSID14X1 = $treeSID12X2 $treeSID14Y1 = $treeSID12Y2 $treeSID14X2 = $treeSID12X1+10 $treeSID14Y2 = $treeSID12Y1-40 $hGUI = GUICreate("Game",@DesktopWidth,@DesktopHeight) GUISetBkColor(0x008000) GUISetState() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphic) $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hPen = _GDIPlus_PenCreate() _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") AdlibRegister("_ReDraw", 20) GUIRegisterMsg(0x000F, "_ReFresh") ;$WM_PAINT = 0x000F OnAutoItExitRegister("_Exit") _GDIPlus_GraphicsDrawLine($hGraphic, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hGraphic, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $headX, $headY, $headWID, $headHEI, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$blockX,$blockY,$blockWID,$blockHEI) _GDIPlus_GraphicsDrawLine($hgraphic, $groundX1, $groundY1, $groundX2, $groundY2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DheadX, $DheadY, $DheadWID, $DheadHEI, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$treebaseX,$treebaseY,$treebaseWID,$treebaseHEI) _GDIPlus_GraphicsDrawLine($hgraphic,$treeBOTX1,$treeBOTY1,$treeBOTX2,$treeBOTY2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID1X1,$treeSID1Y1,$treeSID1X2,$treeSID1y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treesid2X1,$treeSID2Y1,$treeSID2X2,$treeSID2Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID3X1,$treeSID3Y1,$treeSID3X2,$treeSID3Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID4X1,$treeSID4Y1,$treeSID4X2,$treeSID4Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID5X1,$treeSID5Y1,$treeSID5X2,$treeSID5Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID6X1,$treeSID6Y1,$treeSID6X2,$treeSID6Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID7X1,$treeSID7Y1,$treeSID7X2,$treeSID7Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID8X1,$treeSID8Y1,$treeSID8X2,$treeSID8Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID9X1,$treeSID9Y1,$treeSID9X2,$treeSID9Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID10X1,$treeSID10Y1,$treeSID10X2,$treeSID10Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID11X1,$treeSID11Y1,$treeSID11X2,$treeSID11Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID12X1,$treeSID12Y1,$treeSID12X2,$treeSID12Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID13X1,$treeSID13Y1,$treeSID13X2,$treeSID13Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID14X1,$treeSID14Y1,$treeSID14X2,$treeSID14Y2,$hPen) While 1 if _IsPressed("45") then exit if _IsPressed("25") Then ;left arrow $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $redraw = 1 sleep(7) EndIf if _IsPressed("26") Then ;up arrow while $jump < 90 $leg1Y1 -= 2 $leg1Y2 -= 2 $leg2Y1 -= 2 $leg2Y2 -= 2 $bodyY1 -= 2 $bodyY2 -= 2 $arm1Y1 -= 2 $arm1Y2 -= 2 $arm2Y1 -= 2 $arm2Y2 -= 2 $headY -= 2 $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $leg1Y1 += 1 $leg1Y2 += 1 $leg2Y1 += 1 $leg2Y2 += 1 $bodyY1 += 1 $bodyY2 += 1 $arm1Y1 += 1 $arm1Y2 += 1 $arm2Y1 += 1 $arm2Y2 += 1 $headY += 1 $redraw = 1 sleep(7) $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $jump2 += 1 if $leg1Y2 = $blockY and $leg1X2 < $blockX+150 and $leg1X2 > $blockX then ExitLoop if $leg2Y2 = $blockY and $leg2X2 < $blockX+150 and $leg2X2 > $blockX then ExitLoop until $leg1Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("27") Then ;right arrow $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $redraw = 1 sleep(7) EndIf if _IsPressed("28") Then ; down arrow while $jump < 90 $leg1Y1 -= 2 $leg1Y2 -= 2 $leg2Y1 -= 2 $leg2Y2 -= 2 $bodyY1 -= 2 $bodyY2 -= 2 $arm1Y1 -= 2 $arm1Y2 -= 2 $arm2Y1 -= 2 $arm2Y2 -= 2 $headY -= 2 $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $leg1Y1 += 1 $leg1Y2 += 1 $leg2Y1 += 1 $leg2Y2 += 1 $bodyY1 += 1 $bodyY2 += 1 $arm1Y1 += 1 $arm1Y2 += 1 $arm2Y1 += 1 $arm2Y2 += 1 $headY += 1 $redraw = 1 sleep(7) $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $jump2 += 1 if $leg1Y2 = $blockY and $leg1X2 < $blockX+150 and $leg1X2 > $blockX then ExitLoop if $leg2Y2 = $blockY and $leg2X2 < $blockX+150 and $leg2X2 > $blockX then ExitLoop until $leg1Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("45") then exit ;E for Exit if _IsPressed("41") Then ;A $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2X1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $redraw = 1 sleep(7) EndIf if _IsPressed("57") Then ;W while $jump < 90 $Dleg1Y1 -= 2 $Dleg1Y2 -= 2 $Dleg2Y1 -= 2 $Dleg2Y2 -= 2 $DbodyY -= 2 $Dleg3Y1 -= 2 $Dleg3Y2 -= 2 $Dleg4Y1 -= 2 $Dleg4Y2 -= 2 $DheadY -= 2 $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $Dleg1Y1 += 1 $Dleg1Y2 += 1 $Dleg2Y1 += 1 $Dleg2Y2 += 1 $DbodyY += 1 $Dleg3Y1 += 1 $Dleg3Y2 += 1 $Dleg4Y1 += 1 $Dleg4Y2 += 1 $DheadY += 1 $redraw = 1 sleep(7) $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $jump2 += 1 if $Dleg1Y2 = $blockY and $Dleg1X2 < $blockX+150 and $Dleg1X2 > $blockX then ExitLoop if $Dleg4Y2 = $blockY and $Dleg4X2 < $blockX+150 and $Dleg4X2 > $blockX then ExitLoop until $Dleg3Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("44") Then ;D $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $redraw = 1 sleep(7) EndIf if _IsPressed("53") Then ;S while $jump < 90 $Dleg1Y1 -= 2 $Dleg1Y2 -= 2 $Dleg2Y1 -= 2 $Dleg2Y2 -= 2 $DbodyY -= 2 $Dleg3Y1 -= 2 $Dleg3Y2 -= 2 $Dleg4Y1 -= 2 $Dleg4Y2 -= 2 $DheadY -= 2 $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2x1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $Dleg1Y1 += 1 $Dleg1Y2 += 1 $Dleg2Y1 += 1 $Dleg2Y2 += 1 $DbodyY += 1 $Dleg3Y1 += 1 $Dleg3Y2 += 1 $Dleg4Y1 += 1 $Dleg4Y2 += 1 $DheadY += 1 $redraw = 1 sleep(7) $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2x1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $jump2 += 1 if $Dleg1Y2 = $blockY and $Dleg1X2 < $blockX+150 and $Dleg1X2 > $blockX then ExitLoop if $Dleg4Y2 = $blockY and $Dleg4X2 < $blockX+150 and $Dleg4X2 > $blockX then ExitLoop until $Dleg3Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf WEnd EndFunc Func _ReDraw() If $redraw Then _WinAPI_RedrawWindow($hGUI) _GDIPlus_GraphicsDrawLine($hGraphic, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hGraphic, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $headX, $headY, $headWID, $headHEI, $hPen) _GDIPlus_GraphicsfillRect($hgraphic,$blockX,$blockY,$blockWID,$blockHEI) _GDIPlus_GraphicsDrawLine($hgraphic, $groundX1, $groundY1, $groundX2, $groundY2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DheadX, $DheadY, $DheadWID, $DheadHEI, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$treebaseX,$treebaseY,$treebaseWID,$treebaseHEI) _GDIPlus_GraphicsDrawLine($hgraphic,$treeBOTX1,$treeBOTY1,$treeBOTX2,$treeBOTY2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID1X1,$treeSID1Y1,$treeSID1X2,$treeSID1y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treesid2X1,$treeSID2Y1,$treeSID2X2,$treeSID2Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID3X1,$treeSID3Y1,$treeSID3X2,$treeSID3Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID4X1,$treeSID4Y1,$treeSID4X2,$treeSID4Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID5X1,$treeSID5Y1,$treeSID5X2,$treeSID5Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID6X1,$treeSID6Y1,$treeSID6X2,$treeSID6Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID7X1,$treeSID7Y1,$treeSID7X2,$treeSID7Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID8X1,$treeSID8Y1,$treeSID8X2,$treeSID8Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID9X1,$treeSID9Y1,$treeSID9X2,$treeSID9Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID10X1,$treeSID10Y1,$treeSID10X2,$treeSID10Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID11X1,$treeSID11Y1,$treeSID11X2,$treeSID11Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID12X1,$treeSID12Y1,$treeSID12X2,$treeSID12Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID13X1,$treeSID13Y1,$treeSID13X2,$treeSID13Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID14X1,$treeSID14Y1,$treeSID14X2,$treeSID14Y2,$hPen) $redraw = 0 EndIf EndFunc Func _ReFresh() Return "GUI_RUNDEFMSG" EndFunc Func _Exit() GUIRegisterMsg(0x000F, "") AdlibUnRegister("_ReDraw") _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hBuffer) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndFunc Thanks----------------------------------------------------------------------------------AutoITphil Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 5, 2010 Share Posted December 5, 2010 You are already using RGB in GUISetBkColor() so how hard can it be to add A? Don't think too much, just do it .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
AutoITphil Posted December 5, 2010 Author Share Posted December 5, 2010 I only knew that one because of the koda form designer. I have no clue how to determine the red, green, or blue components and I have absolutely no idea what alpha even means. If you do know, could you please help? Link to comment Share on other sites More sharing options...
James Posted December 5, 2010 Share Posted December 5, 2010 (edited) I only knew that one because of the koda form designer. I have no clue how to determine the red, green, or blue components and I have absolutely no idea what alpha even means. If you do know, could you please help?RGB stands for Red Green Blue. It's a colour format for describing hexadecimal codes. Each colour is worth two bytes in length (of the value).Solid red is 0xFF0000Solid green is 0x00FF00Solid blue is 0x0000FFYou can obviously only use hex values; 0-9 A-FAn ARGB value is the same, but there is another value appended after the 0x which describes how transparent the colour is.0xFFFF0000 is a solid red, whilst 0x00FF0000 is transparent. I hope I have that the right way round.You can Google hex colour chart James Edited December 6, 2010 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 5, 2010 Share Posted December 5, 2010 Solid blue is 0x00FF00Copy paste error Solid blue is 0x0000FF .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
iamtheky Posted December 6, 2010 Share Posted December 6, 2010 The dimensions are not exactly correct for the tree, but pressing "E" will turn on the lights. And you are also stuck and can only ESC after you turn them on.... expandcollapse popup#include <WindowsConstants.au3> #include <WinAPI.au3> #Include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <misc.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $hGraphic, $hGUI, $hPen, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $w, $h Global $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $headX, $headY, $headWID, $headHEI, $redraw = 0, $hBitmap, $hBuffer Global $block, $blockX, $blockY, $blockWID, $blockHEI, $jump, $jump2, $ground, $groundX1, $groundX2, $groundY1, $groundY2 Global $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI Global $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $DheadX, $DheadY, $DheadWID, $DheadHEI Global $treebaseX, $treebaseY, $treebaseWID, $treebaseHEI, $treeBOTX1, $treeBOTY1, $treeBOTX2, $treeBOTY2, $treeSID1X1, $treeSID1Y1, $treeSID1X2, $treeSID1Y2 Global $treeSID2X1, $treeSID2Y1, $treeSID2X2, $treeSID2Y2, $treeSID3X1, $treeSID3Y1, $treeSID3X2, $treeSID3Y2, $treeSID4X1, $treeSID4Y1 Global $treeSID4X2, $treeSID4Y2, $treeSID5X1, $treeSID5Y1, $treeSID5X2, $treeSID5Y2, $treeSID6X1, $treeSID6Y1, $treeSID6X2, $treeSID6Y2 Global $treeSID7X1, $treeSID7Y1, $treeSID7X2, $treeSID7Y2, $treeSID8X1, $treeSID8Y1, $treeSID8X2, $treeSID8Y2, $treeSID9X1, $treeSID9Y1 Global $treeSID9X2, $treeSID9Y2, $treeSID10X1, $treeSID10Y1, $treeSID10X2, $treeSID10Y2, $treeSID11X1, $treeSID11Y1, $treeSID11X2, $treeSID11Y2 Global $treeSID12X1, $treeSID12Y1, $treeSID12X2, $treeSID12Y2, $treeSID13X1, $treeSID13Y1, $treeSID13X2, $treeSID13Y2 Global $treeSID14X1, $treeSID14Y1, $treeSID14X2, $treeSID14Y2, $treeMID $w = @DesktopWidth $h = @DesktopHeight main() func main() Local $msg = 0 $leg1X1 = @desktopwidth/2 $leg1Y1 = @desktopheight-300 $leg1X2 = $leg1X1 - 30 $leg1y2 = $leg1Y1 + 80 $leg2X1 = $leg1X1 $leg2Y1 = $leg1Y1 $leg2X2 = $leg2x1 + 30 $leg2Y2 = $leg2Y1 + 80 $bodyX1 = $leg1X1 $bodyY1 = $leg1Y1 $bodyX2 = $leg1X1 $bodyY2 = $leg1Y1 - 100 $arm1X1 = $leg1X1 $arm1Y1 = $bodyY2 $arm1X2 = $leg1X1 - 75 $arm1Y2 = $arm1Y1 + 25 $arm2X1 = $leg1X1 $arm2Y1 = $arm1Y1 $arm2X2 = $leg1X1 + 75 $arm2Y2 = $arm1Y1 + 25 $headX = $bodyX2 - 20 $headY = $bodyY2 - 40 $headWID= 40 $headHEI= 40 $Dleg1X1 = @desktopwidth/2-300 $Dleg1Y1 = @DesktopHeight - 240 $Dleg1X2 = $Dleg1X1 - 15 $Dleg1Y2 = $Dleg1Y1 + 20 $Dleg2X1 = $Dleg1X1 + 7 $Dleg2Y1 = $Dleg1Y1 $Dleg2X2 = $Dleg2X1 $Dleg2Y2 = $Dleg2Y1 + 20 $DbodyX = $Dleg1X1 - 15 $DbodyY = $Dleg1Y1 - 30 $DbodyWID = 70 $DbodyHEI = 30 $Dleg3X1 = $Dleg2X1 + 15 $Dleg3Y1 = $Dleg1Y1 $Dleg3X2 = $Dleg3X1 $Dleg3Y2 = $Dleg3Y1 + 20 $Dleg4X1 = $Dleg3X1 + 7 $Dleg4Y1 = $Dleg1Y1 $Dleg4X2 = $Dleg4X1 + 15 $Dleg4Y2 = $Dleg4Y1 + 20 $DheadX = $DbodyX + 65 $DheadY = $DbodyY - 5 $DheadWID= 18 $DheadHEI= 13 $blockX = 600 $blockY = @DesktopHeight-270 $blockHEI = 50 $blockWID = 150 $jump = 0 $jump2 = 0 $groundX1 = 0 $groundY1 = @DesktopHeight-220 $groundX2 = @DesktopWidth $groundY2 = @DesktopHeight-220 $treeMID = 675 $treebaseX = 660 $treebaseY = @DesktopHeight-295 $treebaseHEI = 25 $treebaseWID = 30 $treeBOTX1 = $treeMID-100 $treeBOTY1 = $treebaseY $treeBOTX2 = $treeMID+100 $treeBOTY2 = $treebaseY $treeSID1X1 = $treeBOTX2 $treeSID1Y1 = $treeBOTY2 $treeSID1X2 = $treeMID+25 $treeSID1Y2 = $treeBOTY2-40 $treeSID2X1 = $treeBOTX1 $treeSID2Y1 = $treeBOTY1 $treeSID2X2 = $treemid-25 $treeSID2Y2 = $treeBOTY1-40 $treeSID3X1 = $treeSID1X2 $treeSID3Y1 = $treeSID1Y2 $treeSID3X2 = $treeSID1X1-10 $treeSID3Y2 = $treeSID1Y1-30 $treeSID4X1 = $treeSID2X2 $treeSID4Y1 = $treeSID2Y2 $treeSID4X2 = $treesid2X1+10 $treeSID4Y2 = $treeSID2Y1-35 $treeSID5X1 = $treeSID3X2 $treeSID5Y1 = $treeSID3Y2 $treeSID5X2 = $treeSID3X1-10 $treeSID5Y2 = $treeSID3Y1-40 $treeSID6X1 = $treeSID4X2 $treeSID6Y1 = $treeSID4Y2 $treeSID6X2 = $treeSID4X1+10 $treeSID6Y2 = $treeSID4Y1-40 $treeSID7X1 = $treeSID5X2 $treeSID7Y1 = $treeSID5Y2 $treeSID7X2 = $treeSID5X1-10 $treeSID7Y2 = $treeSID5Y1-40 $treeSID8X1 = $treeSID6X2 $treeSID8Y1 = $treeSID6Y2 $treeSID8X2 = $treeSID6X1+10 $treeSID8Y2 = $treeSID6Y1-40 $treeSID9X1 = $treeSID7X2 $treeSID9Y1 = $treeSID7Y2 $treeSID9X2 = $treeSID7X1-5 $treeSID9Y2 = $treeSID7Y1-40 $treeSID10X1 = $treeSID8X2 $treeSID10Y1 = $treeSID8Y2 $treeSID10X2 = $treeSID8X1+5 $treeSID10Y2 = $treeSID8Y1-40 $treeSID11X1 = $treeSID9X2 $treeSID11Y1 = $treeSID9Y2 $treeSID11X2 = $treeSID9X1-10 $treeSID11Y2 = $treeSID9Y1-40 $treeSID12X1 = $treeSID10X2 $treeSID12Y1 = $treeSID10Y2 $treeSID12X2 = $treeSID10X1+10 $treeSID12Y2 = $treeSID10Y1-40 $treeSID13X1 = $treeSID11X2 $treeSID13Y1 = $treeSID11Y2 $treeSID13X2 = $treeSID11X1-10 $treeSID13Y2 = $treeSID11Y1-40 $treeSID14X1 = $treeSID12X2 $treeSID14Y1 = $treeSID12Y2 $treeSID14X2 = $treeSID12X1+10 $treeSID14Y2 = $treeSID12Y1-40 $hGUI = GUICreate("Game",@DesktopWidth,@DesktopHeight) GUISetBkColor(0x008000) GUISetState() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphic) $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hPen = _GDIPlus_PenCreate() _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") AdlibRegister("_ReDraw", 20) GUIRegisterMsg(0x000F, "_ReFresh") ;$WM_PAINT = 0x000F OnAutoItExitRegister("_Exit") _GDIPlus_GraphicsDrawLine($hGraphic, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hGraphic, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $headX, $headY, $headWID, $headHEI, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$blockX,$blockY,$blockWID,$blockHEI) _GDIPlus_GraphicsDrawLine($hgraphic, $groundX1, $groundY1, $groundX2, $groundY2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DheadX, $DheadY, $DheadWID, $DheadHEI, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$treebaseX,$treebaseY,$treebaseWID,$treebaseHEI) _GDIPlus_GraphicsDrawLine($hgraphic,$treeBOTX1,$treeBOTY1,$treeBOTX2,$treeBOTY2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID1X1,$treeSID1Y1,$treeSID1X2,$treeSID1y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treesid2X1,$treeSID2Y1,$treeSID2X2,$treeSID2Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID3X1,$treeSID3Y1,$treeSID3X2,$treeSID3Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID4X1,$treeSID4Y1,$treeSID4X2,$treeSID4Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID5X1,$treeSID5Y1,$treeSID5X2,$treeSID5Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID6X1,$treeSID6Y1,$treeSID6X2,$treeSID6Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID7X1,$treeSID7Y1,$treeSID7X2,$treeSID7Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID8X1,$treeSID8Y1,$treeSID8X2,$treeSID8Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID9X1,$treeSID9Y1,$treeSID9X2,$treeSID9Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID10X1,$treeSID10Y1,$treeSID10X2,$treeSID10Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID11X1,$treeSID11Y1,$treeSID11X2,$treeSID11Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID12X1,$treeSID12Y1,$treeSID12X2,$treeSID12Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID13X1,$treeSID13Y1,$treeSID13X2,$treeSID13Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID14X1,$treeSID14Y1,$treeSID14X2,$treeSID14Y2,$hPen) While 1 if _IsPressed("45") then For $E = random(610 , 630) to 630 For $D = random(500 , 510) to 510 For $E2 = random(650 , 680) to 680 For $D2 = random(400 , 450) to 450 For $E3 = random(680 , 715) to 715 For $D3 = random(450 , 510) to 510 For $E4 = random(715 , 745) to 745 For $D4 = random(350 , 510) to 510 For $E5 = random(610 , 745) to 745 For $D5 = random(350 , 510) to 510 For $E6 = random(610 , 745) to 745 For $D6 = random(350 , 510) to 510 For $E7 = random(610 , 745) to 745 For $D7 = random(350 , 510) to 510 For $E8 = random(710 , 730) to 730 For $D8 = random(350 , 380) to 380 local $decColor = pixelgetcolor ($E , $D) local $hexColor = hex($decColor, 6) local $decColor2 = pixelgetcolor ($E2 , $D2) local $hexColor2 = hex($decColor2, 6) local $decColor3 = pixelgetcolor ($E3 , $D3) local $hexColor3 = hex($decColor3, 6) local $decColor4 = pixelgetcolor ($E4 , $D4) local $hexColor4 = hex($decColor4, 6) local $decColor5 = pixelgetcolor ($E5 , $D5) local $hexColor5 = hex($decColor5, 6) local $decColor6 = pixelgetcolor ($E6 , $D6) local $hexColor6 = hex($decColor6, 6) local $decColor7 = pixelgetcolor ($E7 , $D7) local $hexColor7 = hex($decColor7, 6) local $decColor8 = pixelgetcolor ($E8 , $D8) local $hexColor8 = hex($decColor8, 6) _PixelSetColor($E, $D , random(0x000000 , 0xFF0000)) _PixelSetColor($E2, $D2 , random(0x000000 , 0xFF0000)) _PixelSetColor($E3, $D3 , random(0x000000 , 0xFF0000)) _PixelSetColor($E4, $D4 , random(0x000000 , 0xFF0000)) _PixelSetColor($E5, $D5 , random(0x000000 , 0xFF0000)) _PixelSetColor($E6, $D6 , random(0x00FF00 , 0xFF0000)) _PixelSetColor($E7, $D7 , random(0x00FF00 , 0xFF0000)) _PixelSetColor($E8, $D8 , random(0x00FF00 , 0xFF0000)) sleep (500) _PixelSetColor($E, $D , '0x' & $hexColor) _PixelSetColor($E2, $D2 , '0x' & $hexColor2) _PixelSetColor($E3, $D3 , '0x' & $hexColor3) _PixelSetColor($E4, $D4 , '0x' & $hexColor4) _PixelSetColor($E5, $D5 , '0x' & $hexColor5) _PixelSetColor($E6, $D6 , '0x' & $hexColor6) _PixelSetColor($E7, $D7, '0x' & $hexColor7) _PixelSetColor($E8, $D8 , '0x' & $hexColor8) Next Next Next Next Next Next Next Next Next Next Next Next Next Next Next Next endif if _IsPressed("25") Then ;left arrow $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $redraw = 1 sleep(7) EndIf if _IsPressed("26") Then ;up arrow while $jump < 90 $leg1Y1 -= 2 $leg1Y2 -= 2 $leg2Y1 -= 2 $leg2Y2 -= 2 $bodyY1 -= 2 $bodyY2 -= 2 $arm1Y1 -= 2 $arm1Y2 -= 2 $arm2Y1 -= 2 $arm2Y2 -= 2 $headY -= 2 $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $leg1Y1 += 1 $leg1Y2 += 1 $leg2Y1 += 1 $leg2Y2 += 1 $bodyY1 += 1 $bodyY2 += 1 $arm1Y1 += 1 $arm1Y2 += 1 $arm2Y1 += 1 $arm2Y2 += 1 $headY += 1 $redraw = 1 sleep(7) $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $jump2 += 1 if $leg1Y2 = $blockY and $leg1X2 < $blockX+150 and $leg1X2 > $blockX then ExitLoop if $leg2Y2 = $blockY and $leg2X2 < $blockX+150 and $leg2X2 > $blockX then ExitLoop until $leg1Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("27") Then ;right arrow $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $redraw = 1 sleep(7) EndIf if _IsPressed("28") Then ; down arrow while $jump < 90 $leg1Y1 -= 2 $leg1Y2 -= 2 $leg2Y1 -= 2 $leg2Y2 -= 2 $bodyY1 -= 2 $bodyY2 -= 2 $arm1Y1 -= 2 $arm1Y2 -= 2 $arm2Y1 -= 2 $arm2Y2 -= 2 $headY -= 2 $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $leg1Y1 += 1 $leg1Y2 += 1 $leg2Y1 += 1 $leg2Y2 += 1 $bodyY1 += 1 $bodyY2 += 1 $arm1Y1 += 1 $arm1Y2 += 1 $arm2Y1 += 1 $arm2Y2 += 1 $headY += 1 $redraw = 1 sleep(7) $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $jump2 += 1 if $leg1Y2 = $blockY and $leg1X2 < $blockX+150 and $leg1X2 > $blockX then ExitLoop if $leg2Y2 = $blockY and $leg2X2 < $blockX+150 and $leg2X2 > $blockX then ExitLoop until $leg1Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("41") Then ;A $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2X1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $redraw = 1 sleep(7) EndIf if _IsPressed("57") Then ;W while $jump < 90 $Dleg1Y1 -= 2 $Dleg1Y2 -= 2 $Dleg2Y1 -= 2 $Dleg2Y2 -= 2 $DbodyY -= 2 $Dleg3Y1 -= 2 $Dleg3Y2 -= 2 $Dleg4Y1 -= 2 $Dleg4Y2 -= 2 $DheadY -= 2 $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $Dleg1Y1 += 1 $Dleg1Y2 += 1 $Dleg2Y1 += 1 $Dleg2Y2 += 1 $DbodyY += 1 $Dleg3Y1 += 1 $Dleg3Y2 += 1 $Dleg4Y1 += 1 $Dleg4Y2 += 1 $DheadY += 1 $redraw = 1 sleep(7) $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $jump2 += 1 if $Dleg1Y2 = $blockY and $Dleg1X2 < $blockX+150 and $Dleg1X2 > $blockX then ExitLoop if $Dleg4Y2 = $blockY and $Dleg4X2 < $blockX+150 and $Dleg4X2 > $blockX then ExitLoop until $Dleg3Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("44") Then ;D $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $redraw = 1 sleep(7) EndIf if _IsPressed("53") Then ;S while $jump < 90 $Dleg1Y1 -= 2 $Dleg1Y2 -= 2 $Dleg2Y1 -= 2 $Dleg2Y2 -= 2 $DbodyY -= 2 $Dleg3Y1 -= 2 $Dleg3Y2 -= 2 $Dleg4Y1 -= 2 $Dleg4Y2 -= 2 $DheadY -= 2 $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2x1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $Dleg1Y1 += 1 $Dleg1Y2 += 1 $Dleg2Y1 += 1 $Dleg2Y2 += 1 $DbodyY += 1 $Dleg3Y1 += 1 $Dleg3Y2 += 1 $Dleg4Y1 += 1 $Dleg4Y2 += 1 $DheadY += 1 $redraw = 1 sleep(7) $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2x1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $jump2 += 1 if $Dleg1Y2 = $blockY and $Dleg1X2 < $blockX+150 and $Dleg1X2 > $blockX then ExitLoop if $Dleg4Y2 = $blockY and $Dleg4X2 < $blockX+150 and $Dleg4X2 > $blockX then ExitLoop until $Dleg3Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf WEnd EndFunc Func _ReDraw() If $redraw Then _WinAPI_RedrawWindow($hGUI) _GDIPlus_GraphicsDrawLine($hGraphic, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hGraphic, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $headX, $headY, $headWID, $headHEI, $hPen) _GDIPlus_GraphicsfillRect($hgraphic,$blockX,$blockY,$blockWID,$blockHEI) _GDIPlus_GraphicsDrawLine($hgraphic, $groundX1, $groundY1, $groundX2, $groundY2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DheadX, $DheadY, $DheadWID, $DheadHEI, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$treebaseX,$treebaseY,$treebaseWID,$treebaseHEI) _GDIPlus_GraphicsDrawLine($hgraphic,$treeBOTX1,$treeBOTY1,$treeBOTX2,$treeBOTY2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID1X1,$treeSID1Y1,$treeSID1X2,$treeSID1y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treesid2X1,$treeSID2Y1,$treeSID2X2,$treeSID2Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID3X1,$treeSID3Y1,$treeSID3X2,$treeSID3Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID4X1,$treeSID4Y1,$treeSID4X2,$treeSID4Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID5X1,$treeSID5Y1,$treeSID5X2,$treeSID5Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID6X1,$treeSID6Y1,$treeSID6X2,$treeSID6Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID7X1,$treeSID7Y1,$treeSID7X2,$treeSID7Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID8X1,$treeSID8Y1,$treeSID8X2,$treeSID8Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID9X1,$treeSID9Y1,$treeSID9X2,$treeSID9Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID10X1,$treeSID10Y1,$treeSID10X2,$treeSID10Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID11X1,$treeSID11Y1,$treeSID11X2,$treeSID11Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID12X1,$treeSID12Y1,$treeSID12X2,$treeSID12Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID13X1,$treeSID13Y1,$treeSID13X2,$treeSID13Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID14X1,$treeSID14Y1,$treeSID14X2,$treeSID14Y2,$hPen) $redraw = 0 EndIf EndFunc Func _PixelSetColor($XCoord, $YCoord, $Color) Local $dc = DllCall("user32.dll", "int", "GetDC", "hwnd", 0) If Not IsArray($dc) Then Return -1 DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $XCoord, "long", $YCoord, "long", _ "0x" & StringRegExpReplace(hex($Color,6), "(..)(..)(..)", "\3\2\1")) ; Change to 0xBBGGRR hex colour format. DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "hwnd", $dc[0]) EndFunc ;==>_PixelSetColor Func _HPSleep($iSleep, $fMs = 1) ; default is milliseconds, otherwise microseconds (1 ms = 1000 µs) If $fMs Then $iSleep *= 1000 ; convert to ms DllCall("ntdll.dll", "dword", "NtDelayExecution", "int", 0, "int64*", -10 * $iSleep) EndFunc Func _ReFresh() Return "GUI_RUNDEFMSG" EndFunc Func _Exit() GUIRegisterMsg(0x000F, "") AdlibUnRegister("_ReDraw") _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hBuffer) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndFunc ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
James Posted December 6, 2010 Share Posted December 6, 2010 Copy paste error Solid blue is 0x0000FFSadly it wasn't a copy and paste job Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
AutoITphil Posted December 7, 2010 Author Share Posted December 7, 2010 (edited) Thanks JamesBrooks. That clears up my question about hex colors. And thank you iamtheky, this looks pretty good. I'll play around with it and see what I can do. But if you could also go into some specifics about the functions you created, that would be great. I also was having trouble figuring out what the specific function was to physically change the color. Edited December 7, 2010 by AutoITphil Link to comment Share on other sites More sharing options...
iamtheky Posted December 7, 2010 Share Posted December 7, 2010 first i pixelgetcolor so i can set it back _PixelSetColor(X-location, Y-location , random(0x000000 , 0xFF0000)) sets that one pixel to one random color. the last argument is color, i probably should have made all of those (0x000000 , 0xFFFFFF) to include all colors. The stuff above that is just picking a few different locations from different quadrants on the tree, because the random is not spectacularly random and that seems to help it out. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
AutoITphil Posted December 8, 2010 Author Share Posted December 8, 2010 iamtheky, I was playing around with the script, I like your method, but I think I found an easier way. I haven't quite gotten it perfect, or even quite working, but it seems good. I just make some different colored _gdiplus_graphicsfillellipse and they work well. But I am having trouble making it so that every three seconds the first ones delete and new ones are drawn. Well here it is: expandcollapse popup#include <WindowsConstants.au3> #include <WinAPI.au3> #Include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <misc.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $hGraphic, $hGUI, $hPen, $hRed, $hBlue, $hYellow, $hPurple, $hBlack Global $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $w, $h Global $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $headX, $headY, $headWID, $headHEI, $redraw = 0, $hBitmap, $hBuffer Global $block, $blockX, $blockY, $blockWID, $blockHEI, $jump, $jump2, $ground, $groundX1, $groundX2, $groundY1, $groundY2 Global $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI Global $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $DheadX, $DheadY, $DheadWID, $DheadHEI Global $treebaseX, $treebaseY, $treebaseWID, $treebaseHEI, $treeBOTX1, $treeBOTY1, $treeBOTX2, $treeBOTY2, $treeSID1X1, $treeSID1Y1, $treeSID1X2, $treeSID1Y2 Global $treeSID2X1, $treeSID2Y1, $treeSID2X2, $treeSID2Y2, $treeSID3X1, $treeSID3Y1, $treeSID3X2, $treeSID3Y2, $treeSID4X1, $treeSID4Y1 Global $treeSID4X2, $treeSID4Y2, $treeSID5X1, $treeSID5Y1, $treeSID5X2, $treeSID5Y2, $treeSID6X1, $treeSID6Y1, $treeSID6X2, $treeSID6Y2 Global $treeSID7X1, $treeSID7Y1, $treeSID7X2, $treeSID7Y2, $treeSID8X1, $treeSID8Y1, $treeSID8X2, $treeSID8Y2, $treeSID9X1, $treeSID9Y1 Global $treeSID9X2, $treeSID9Y2, $treeSID10X1, $treeSID10Y1, $treeSID10X2, $treeSID10Y2, $treeSID11X1, $treeSID11Y1, $treeSID11X2, $treeSID11Y2 Global $treeSID12X1, $treeSID12Y1, $treeSID12X2, $treeSID12Y2, $treeSID13X1, $treeSID13Y1, $treeSID13X2, $treeSID13Y2 Global $treeSID14X1, $treeSID14Y1, $treeSID14X2, $treeSID14Y2, $treeMID Global $LIGHTdelay, $REDligX, $REDligY, $BLUEligX, $BLUEligY, $BLACKligX, $BLACKligY, $YELligX, $YELligY, $PURligX, $PURligY Global $REDlig2X, $REDlig2Y, $BLUElig2X, $BLUElig2Y, $BLACKlig2X, $BLACKlig2Y, $YELlig2X, $YELlig2Y, $PURlig2X, $PURlig2Y $w = @DesktopWidth $h = @DesktopHeight main() func main() Local $msg = 0 $leg1X1 = @desktopwidth/2 $leg1Y1 = @desktopheight-300 $leg1X2 = $leg1X1 - 30 $leg1y2 = $leg1Y1 + 80 $leg2X1 = $leg1X1 $leg2Y1 = $leg1Y1 $leg2X2 = $leg2x1 + 30 $leg2Y2 = $leg2Y1 + 80 $bodyX1 = $leg1X1 $bodyY1 = $leg1Y1 $bodyX2 = $leg1X1 $bodyY2 = $leg1Y1 - 100 $arm1X1 = $leg1X1 $arm1Y1 = $bodyY2 $arm1X2 = $leg1X1 - 75 $arm1Y2 = $arm1Y1 + 25 $arm2X1 = $leg1X1 $arm2Y1 = $arm1Y1 $arm2X2 = $leg1X1 + 75 $arm2Y2 = $arm1Y1 + 25 $headX = $bodyX2 - 20 $headY = $bodyY2 - 40 $headWID= 40 $headHEI= 40 $Dleg1X1 = @desktopwidth/2-300 $Dleg1Y1 = @DesktopHeight - 240 $Dleg1X2 = $Dleg1X1 - 15 $Dleg1Y2 = $Dleg1Y1 + 20 $Dleg2X1 = $Dleg1X1 + 7 $Dleg2Y1 = $Dleg1Y1 $Dleg2X2 = $Dleg2X1 $Dleg2Y2 = $Dleg2Y1 + 20 $DbodyX = $Dleg1X1 - 15 $DbodyY = $Dleg1Y1 - 30 $DbodyWID = 70 $DbodyHEI = 30 $Dleg3X1 = $Dleg2X1 + 15 $Dleg3Y1 = $Dleg1Y1 $Dleg3X2 = $Dleg3X1 $Dleg3Y2 = $Dleg3Y1 + 20 $Dleg4X1 = $Dleg3X1 + 7 $Dleg4Y1 = $Dleg1Y1 $Dleg4X2 = $Dleg4X1 + 15 $Dleg4Y2 = $Dleg4Y1 + 20 $DheadX = $DbodyX + 65 $DheadY = $DbodyY - 5 $DheadWID= 18 $DheadHEI= 13 $blockX = 600 $blockY = @DesktopHeight-270 $blockHEI = 50 $blockWID = 150 $jump = 0 $jump2 = 0 $groundX1 = 0 $groundY1 = @DesktopHeight-220 $groundX2 = @DesktopWidth $groundY2 = @DesktopHeight-220 $treeMID = 675 $treebaseX = 660 $treebaseY = @DesktopHeight-295 $treebaseHEI = 25 $treebaseWID = 30 $treeBOTX1 = $treeMID-100 $treeBOTY1 = $treebaseY $treeBOTX2 = $treeMID+100 $treeBOTY2 = $treebaseY $treeSID1X1 = $treeBOTX2 $treeSID1Y1 = $treeBOTY2 $treeSID1X2 = $treeMID+25 $treeSID1Y2 = $treeBOTY2-40 $treeSID2X1 = $treeBOTX1 $treeSID2Y1 = $treeBOTY1 $treeSID2X2 = $treemid-25 $treeSID2Y2 = $treeBOTY1-40 $treeSID3X1 = $treeSID1X2 $treeSID3Y1 = $treeSID1Y2 $treeSID3X2 = $treeSID1X1-10 $treeSID3Y2 = $treeSID1Y1-30 $treeSID4X1 = $treeSID2X2 $treeSID4Y1 = $treeSID2Y2 $treeSID4X2 = $treesid2X1+10 $treeSID4Y2 = $treeSID2Y1-35 $treeSID5X1 = $treeSID3X2 $treeSID5Y1 = $treeSID3Y2 $treeSID5X2 = $treeSID3X1-10 $treeSID5Y2 = $treeSID3Y1-40 $treeSID6X1 = $treeSID4X2 $treeSID6Y1 = $treeSID4Y2 $treeSID6X2 = $treeSID4X1+10 $treeSID6Y2 = $treeSID4Y1-40 $treeSID7X1 = $treeSID5X2 $treeSID7Y1 = $treeSID5Y2 $treeSID7X2 = $treeSID5X1-10 $treeSID7Y2 = $treeSID5Y1-40 $treeSID8X1 = $treeSID6X2 $treeSID8Y1 = $treeSID6Y2 $treeSID8X2 = $treeSID6X1+10 $treeSID8Y2 = $treeSID6Y1-40 $treeSID9X1 = $treeSID7X2 $treeSID9Y1 = $treeSID7Y2 $treeSID9X2 = $treeSID7X1-5 $treeSID9Y2 = $treeSID7Y1-40 $treeSID10X1 = $treeSID8X2 $treeSID10Y1 = $treeSID8Y2 $treeSID10X2 = $treeSID8X1+5 $treeSID10Y2 = $treeSID8Y1-40 $treeSID11X1 = $treeSID9X2 $treeSID11Y1 = $treeSID9Y2 $treeSID11X2 = $treeSID9X1-10 $treeSID11Y2 = $treeSID9Y1-40 $treeSID12X1 = $treeSID10X2 $treeSID12Y1 = $treeSID10Y2 $treeSID12X2 = $treeSID10X1+10 $treeSID12Y2 = $treeSID10Y1-40 $treeSID13X1 = $treeSID11X2 $treeSID13Y1 = $treeSID11Y2 $treeSID13X2 = $treeSID11X1-10 $treeSID13Y2 = $treeSID11Y1-40 $treeSID14X1 = $treeSID12X2 $treeSID14Y1 = $treeSID12Y2 $treeSID14X2 = $treeSID12X1+10 $treeSID14Y2 = $treeSID12Y1-40 $LIGHTdelay= 0 $REDligX = $treeSID13X2-20 $REDligY = $treeSID13Y2+20 $BLUEligX = $REDligX+30 $BLUEligY = $REDligY+40 $PURligX = $BLUEligX-40 $PURligY = $BLUEligY+40 $YELligX = $PURligX+55 $YELligY = $PURligY-5 $BLACKligX = $YELligX-70 $BLACKligY = $YELligY+40 $REDlig2X = $PURligX+40 $REDlig2Y = $PURligY-45 $BLUElig2X = $BLACKligX+80 $BLUElig2Y = $BLACKligY $PURlig2X = $YELligX-50 $PURlig2Y = $YELligY $YELlig2X = $REDligX+25 $YELlig2Y = $REDligY-5 $BLACKlig2X = $BLUEligX-60 $BLACKlig2Y = $BLUEligY+5 $hGUI = GUICreate("Game",@DesktopWidth,@DesktopHeight) GUISetBkColor(0x008000) GUISetState() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBitmap = _GDIPlus_BitmapCreateFromGraphics($w, $h, $hGraphic) $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) $hPen = _GDIPlus_PenCreate() $hRed = _GDIPlus_BrushCreateSolid(0xFFF30707) $hBlack = _GDIPlus_BrushCreateSolid(0xFF000000) $hBlue = _GDIPlus_BrushCreateSolid(0xFF2C1EF1) $hPurple = _GDIPlus_BrushCreateSolid(0xFFEE0AF1) $hYellow = _GDIPlus_BrushCreateSolid(0xFFFCFF20) _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") AdlibRegister("_ReDraw", 20) GUIRegisterMsg(0x000F, "_ReFresh") ;$WM_PAINT = 0x000F OnAutoItExitRegister("_Exit") _GDIPlus_GraphicsDrawLine($hGraphic, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hGraphic, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $headX, $headY, $headWID, $headHEI, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$blockX,$blockY,$blockWID,$blockHEI) _GDIPlus_GraphicsDrawLine($hgraphic, $groundX1, $groundY1, $groundX2, $groundY2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DheadX, $DheadY, $DheadWID, $DheadHEI, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$treebaseX,$treebaseY,$treebaseWID,$treebaseHEI) _GDIPlus_GraphicsDrawLine($hgraphic,$treeBOTX1,$treeBOTY1,$treeBOTX2,$treeBOTY2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID1X1,$treeSID1Y1,$treeSID1X2,$treeSID1y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treesid2X1,$treeSID2Y1,$treeSID2X2,$treeSID2Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID3X1,$treeSID3Y1,$treeSID3X2,$treeSID3Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID4X1,$treeSID4Y1,$treeSID4X2,$treeSID4Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID5X1,$treeSID5Y1,$treeSID5X2,$treeSID5Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID6X1,$treeSID6Y1,$treeSID6X2,$treeSID6Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID7X1,$treeSID7Y1,$treeSID7X2,$treeSID7Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID8X1,$treeSID8Y1,$treeSID8X2,$treeSID8Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID9X1,$treeSID9Y1,$treeSID9X2,$treeSID9Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID10X1,$treeSID10Y1,$treeSID10X2,$treeSID10Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID11X1,$treeSID11Y1,$treeSID11X2,$treeSID11Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID12X1,$treeSID12Y1,$treeSID12X2,$treeSID12Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID13X1,$treeSID13Y1,$treeSID13X2,$treeSID13Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID14X1,$treeSID14Y1,$treeSID14X2,$treeSID14Y2,$hPen) _GDIPlus_GraphicsfillEllipse($hgraphic, $REDligX, $REDligY, 15,15, $hRed) _GDIPlus_GraphicsfillEllipse($hgraphic, $BLUEligX, $BLUEligY, 15, 15, $hBlue) _GDIPlus_GraphicsfillEllipse($hgraphic, $PURligX, $PURligY, 15, 15, $hPurple) _GDIPlus_GraphicsfillEllipse($hgraphic, $YELligX, $YELligY, 15, 15, $hYellow) _GDIPlus_GraphicsfillEllipse($hgraphic, $BLACKligX, $BLACKligY, 15, 15, $hBlack) While 1 if _IsPressed("45") then exit if _IsPressed("25") Then ;left arrow $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $redraw = 1 sleep(7) EndIf if _IsPressed("26") Then ;up arrow while $jump < 90 $leg1Y1 -= 2 $leg1Y2 -= 2 $leg2Y1 -= 2 $leg2Y2 -= 2 $bodyY1 -= 2 $bodyY2 -= 2 $arm1Y1 -= 2 $arm1Y2 -= 2 $arm2Y1 -= 2 $arm2Y2 -= 2 $headY -= 2 $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $leg1Y1 += 1 $leg1Y2 += 1 $leg2Y1 += 1 $leg2Y2 += 1 $bodyY1 += 1 $bodyY2 += 1 $arm1Y1 += 1 $arm1Y2 += 1 $arm2Y1 += 1 $arm2Y2 += 1 $headY += 1 $redraw = 1 sleep(7) $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $jump2 += 1 if $leg1Y2 = $blockY and $leg1X2 < $blockX+150 and $leg1X2 > $blockX then ExitLoop if $leg2Y2 = $blockY and $leg2X2 < $blockX+150 and $leg2X2 > $blockX then ExitLoop until $leg1Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("27") Then ;right arrow $leg1X1 += 1 $leg1X2 += 1 $leg2x1 += 1 $leg2X2 += 1 $bodyX1 += 1 $bodyX2 += 1 $arm1X1 += 1 $arm1X2 += 1 $arm2X1 += 1 $arm2X2 += 1 $headX += 1 $redraw = 1 sleep(7) EndIf if _IsPressed("28") Then ; down arrow while $jump < 90 $leg1Y1 -= 2 $leg1Y2 -= 2 $leg2Y1 -= 2 $leg2Y2 -= 2 $bodyY1 -= 2 $bodyY2 -= 2 $arm1Y1 -= 2 $arm1Y2 -= 2 $arm2Y1 -= 2 $arm2Y2 -= 2 $headY -= 2 $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $leg1Y1 += 1 $leg1Y2 += 1 $leg2Y1 += 1 $leg2Y2 += 1 $bodyY1 += 1 $bodyY2 += 1 $arm1Y1 += 1 $arm1Y2 += 1 $arm2Y1 += 1 $arm2Y2 += 1 $headY += 1 $redraw = 1 sleep(7) $leg1X1 -= 1 $leg1X2 -= 1 $leg2x1 -= 1 $leg2X2 -= 1 $bodyX1 -= 1 $bodyX2 -= 1 $arm1X1 -= 1 $arm1X2 -= 1 $arm2X1 -= 1 $arm2X2 -= 1 $headX -= 1 $jump2 += 1 if $leg1Y2 = $blockY and $leg1X2 < $blockX+150 and $leg1X2 > $blockX then ExitLoop if $leg2Y2 = $blockY and $leg2X2 < $blockX+150 and $leg2X2 > $blockX then ExitLoop until $leg1Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("45") then exit ;E for Exit if _IsPressed("41") Then ;A $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2X1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $redraw = 1 sleep(7) EndIf if _IsPressed("57") Then ;W while $jump < 90 $Dleg1Y1 -= 2 $Dleg1Y2 -= 2 $Dleg2Y1 -= 2 $Dleg2Y2 -= 2 $DbodyY -= 2 $Dleg3Y1 -= 2 $Dleg3Y2 -= 2 $Dleg4Y1 -= 2 $Dleg4Y2 -= 2 $DheadY -= 2 $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $Dleg1Y1 += 1 $Dleg1Y2 += 1 $Dleg2Y1 += 1 $Dleg2Y2 += 1 $DbodyY += 1 $Dleg3Y1 += 1 $Dleg3Y2 += 1 $Dleg4Y1 += 1 $Dleg4Y2 += 1 $DheadY += 1 $redraw = 1 sleep(7) $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $jump2 += 1 if $Dleg1Y2 = $blockY and $Dleg1X2 < $blockX+150 and $Dleg1X2 > $blockX then ExitLoop if $Dleg4Y2 = $blockY and $Dleg4X2 < $blockX+150 and $Dleg4X2 > $blockX then ExitLoop until $Dleg3Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf if _IsPressed("44") Then ;D $Dleg1X1 += 1 $Dleg1X2 += 1 $Dleg2x1 += 1 $Dleg2X2 += 1 $DbodyX += 1 $Dleg3X1 += 1 $Dleg3X2 += 1 $Dleg4X1 += 1 $Dleg4X2 += 1 $DheadX += 1 $redraw = 1 sleep(7) EndIf if _IsPressed("53") Then ;S while $jump < 90 $Dleg1Y1 -= 2 $Dleg1Y2 -= 2 $Dleg2Y1 -= 2 $Dleg2Y2 -= 2 $DbodyY -= 2 $Dleg3Y1 -= 2 $Dleg3Y2 -= 2 $Dleg4Y1 -= 2 $Dleg4Y2 -= 2 $DheadY -= 2 $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2x1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $redraw = 1 sleep(7) $jump += 2 WEnd do $Dleg1Y1 += 1 $Dleg1Y2 += 1 $Dleg2Y1 += 1 $Dleg2Y2 += 1 $DbodyY += 1 $Dleg3Y1 += 1 $Dleg3Y2 += 1 $Dleg4Y1 += 1 $Dleg4Y2 += 1 $DheadY += 1 $redraw = 1 sleep(7) $Dleg1X1 -= 1 $Dleg1X2 -= 1 $Dleg2x1 -= 1 $Dleg2X2 -= 1 $DbodyX -= 1 $Dleg3X1 -= 1 $Dleg3X2 -= 1 $Dleg4X1 -= 1 $Dleg4X2 -= 1 $DheadX -= 1 $jump2 += 1 if $Dleg1Y2 = $blockY and $Dleg1X2 < $blockX+150 and $Dleg1X2 > $blockX then ExitLoop if $Dleg4Y2 = $blockY and $Dleg4X2 < $blockX+150 and $Dleg4X2 > $blockX then ExitLoop until $Dleg3Y2 = $groundY1 $jump = 0 $jump2 = 0 EndIf WEnd EndFunc Func _ReDraw() If $redraw Then _WinAPI_RedrawWindow($hGUI) _GDIPlus_GraphicsDrawLine($hGraphic, $leg1X1, $leg1Y1, $leg1X2, $leg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hGraphic, $leg2X1, $leg2Y1, $leg2X2, $leg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $bodyX1, $bodyY1, $bodyX2, $bodyY2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm1X1, $arm1Y1, $arm1X2, $arm1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $arm2X1, $arm2Y1, $arm2X2, $arm2Y2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $headX, $headY, $headWID, $headHEI, $hPen) _GDIPlus_GraphicsfillRect($hgraphic,$blockX,$blockY,$blockWID,$blockHEI) _GDIPlus_GraphicsDrawLine($hgraphic, $groundX1, $groundY1, $groundX2, $groundY2, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DbodyX, $DbodyY, $DbodyWID, $DbodyHEI, $hPen) _GDIPlus_GraphicsDrawEllipse($hgraphic, $DheadX, $DheadY, $DheadWID, $DheadHEI, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg1X1, $Dleg1Y1, $Dleg1X2, $Dleg1Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg2X1, $Dleg2Y1, $Dleg2X2, $Dleg2Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg3X1, $Dleg3Y1, $Dleg3X2, $Dleg3Y2, $hPen) _GDIPlus_GraphicsDrawLine($hgraphic, $Dleg4X1, $Dleg4Y1, $Dleg4X2, $Dleg4Y2, $hPen) _GDIPlus_GraphicsFillRect($hgraphic,$treebaseX,$treebaseY,$treebaseWID,$treebaseHEI) _GDIPlus_GraphicsDrawLine($hgraphic,$treeBOTX1,$treeBOTY1,$treeBOTX2,$treeBOTY2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID1X1,$treeSID1Y1,$treeSID1X2,$treeSID1y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treesid2X1,$treeSID2Y1,$treeSID2X2,$treeSID2Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID3X1,$treeSID3Y1,$treeSID3X2,$treeSID3Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID4X1,$treeSID4Y1,$treeSID4X2,$treeSID4Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID5X1,$treeSID5Y1,$treeSID5X2,$treeSID5Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID6X1,$treeSID6Y1,$treeSID6X2,$treeSID6Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID7X1,$treeSID7Y1,$treeSID7X2,$treeSID7Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID8X1,$treeSID8Y1,$treeSID8X2,$treeSID8Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID9X1,$treeSID9Y1,$treeSID9X2,$treeSID9Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID10X1,$treeSID10Y1,$treeSID10X2,$treeSID10Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID11X1,$treeSID11Y1,$treeSID11X2,$treeSID11Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID12X1,$treeSID12Y1,$treeSID12X2,$treeSID12Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID13X1,$treeSID13Y1,$treeSID13X2,$treeSID13Y2,$hPen) _GDIPlus_GraphicsDrawLine($hgraphic,$treeSID14X1,$treeSID14Y1,$treeSID14X2,$treeSID14Y2,$hPen) While $LIGHTdelay < 4 _GDIPlus_GraphicsfillEllipse($hgraphic, $REDligX, $REDligY, 15,15, $hRed) _GDIPlus_GraphicsfillEllipse($hgraphic, $BLUEligX, $BLUEligY, 15, 15, $hBlue) _GDIPlus_GraphicsfillEllipse($hgraphic, $PURligX, $PURligY, 15, 15, $hPurple) _GDIPlus_GraphicsfillEllipse($hgraphic, $YELligX, $YELligY, 15, 15, $hYellow) _GDIPlus_GraphicsfillEllipse($hgraphic, $BLACKligX, $BLACKligY, 15, 15, $hBlack) sleep(1000) $lightdelay += 1 WEnd while $lightdelay > 3 _GDIPlus_GraphicsfillEllipse($hgraphic, $REDlig2X, $REDlig2Y, 15,15, $hRed) _GDIPlus_GraphicsfillEllipse($hgraphic, $BLUElig2X, $BLUElig2Y, 15, 15, $hBlue) _GDIPlus_GraphicsfillEllipse($hgraphic, $PURlig2X, $PURlig2Y, 15, 15, $hPurple) _GDIPlus_GraphicsfillEllipse($hgraphic, $YELlig2X, $YELlig2Y, 15, 15, $hYellow) _GDIPlus_GraphicsfillEllipse($hgraphic, $BLACKlig2X, $BLACKlig2Y, 15, 15, $hBlack) sleep(1000) $lightdelay += 1 WEnd $lightdelay = 0 $redraw = 0 EndIf EndFunc Func _ReFresh() Return "GUI_RUNDEFMSG" EndFunc Func _Exit() GUIRegisterMsg(0x000F, "") AdlibUnRegister("_ReDraw") _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hRed) _GDIPlus_PenDispose($hBlue) _GDIPlus_PenDispose($hBlack) _GDIPlus_PenDispose($hYellow) _GDIPlus_PenDispose($hPurple) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hBuffer) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndFunc Around line 197 I set the colors for the lights. I believe my troubles start at line 589. If you or someone else could take a quick look, that would be great. Thanks a lot-----------------------------------------AutoITphil 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