GDI+ ... wie ich es liebe!

  • Klappe die 2.!

    Ich habe jetzt folgendes Skript relativ weit gebracht.

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.8.1
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ID-Liste

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -3 => Monster 3
    -2 => Monster 2
    -1 => Monster 1
    0 => Leeres Feld/Gras
    1 => Spieler Position
    2 => Wand/Fels/Berg
    3 => Spieler Upgrade
    4 => Item
    5 => Quest

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------
    #include <GuiConstants.au3>
    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $Map_Line1,$Map_Line2,$Map_Line3,$Map_Line4,$Map_Line5,$Map_Line6,$Map_Line7
    Global $player, $stein, $gras

    [/autoit] [autoit][/autoit] [autoit]

    $GuiWidth = 400
    $GuiHeight = 500
    $Width = 100
    $Height = 100
    $PlayerPosX = 49
    $PlayerPosY = 49

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aMap[$Width][$Height]
    Dim $Show[7][7]

    [/autoit] [autoit][/autoit] [autoit]

    If FileExists(@ScriptDir & "\Map_X.ini") == 1 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = IniRead("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",0)
    Next
    Next
    Else
    If FileExists(@ScriptDir & "\Map_X.ini") == 0 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = 0
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",$aMap[$i][$i2])
    Next
    Next
    For $i = 0 To $Width - 1 Step 1
    $aMap[$i][0] = 2
    $aMap[$i][$Height - 1] = 2
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][0]",$aMap[$i][0])
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $Height - 1 & "]",$aMap[$i][$Height - 1])
    Next
    For $i = 0 To $Height - 1 Step 1
    $aMap[0][$i] = 2
    $aMap[$Width - 1][$i] = 2
    IniWrite("Map_X.ini","Map","$aMap[0][" & $i & "]",$aMap[0][$i])
    IniWrite("Map_X.ini","Map","$aMap[" & $Width - 1 & "][" & $i & "]",$aMap[$Width - 1][$i])
    Next
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $aMap[$PlayerPosX][$PlayerPosY] = 1

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("MyGui",$GuiWidth,$GuiHeight)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)

    [/autoit] [autoit][/autoit] [autoit]

    ;$Bitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphics)
    ;$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

    [/autoit] [autoit][/autoit] [autoit]

    $hBtn_W = GUICtrlCreateButton(ChrW(8593),190,400,30,30)
    $hBtn_A = GUICtrlCreateButton(ChrW(8592),160,430,30,30)
    $hBtn_S = GUICtrlCreateButton(ChrW(8595),190,460,30,30)
    $hBtn_D = GUICtrlCreateButton(ChrW(8594),220,430,30,30)

    [/autoit] [autoit][/autoit] [autoit]

    $hLabel_Main = GUICtrlCreateLabel("test",10,10,380,290)
    ;GUICtrlSetState($hLabel_Main,$GUI_HIDE)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $gras = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\gras.png")
    $stein = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\stein.png")
    $player = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\player.png")

    [/autoit] [autoit][/autoit] [autoit]

    _Draw($hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(10)
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsClear($hGraphics)
    _GDIPlus_GraphicsDispose($hGraphics)
    ;_GDIPlus_BitmapDispose($Bitmap)
    _GDIPlus_Shutdown()
    Exit
    Case $hBtn_A
    _Btn_A()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    Case $hBtn_D
    _Btn_D()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    Case $hBtn_S
    _Btn_S()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    Case $hBtn_W
    _Btn_W()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($hGraphics)
    EndSwitch
    ToolTip("X:" & $PlayerPosX & @CRLF & "Y:" & $PlayerPosY & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & $aMap[$PlayerPosX][$PlayerPosY - 1] & $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY] & $aMap[$PlayerPosX][$PlayerPosY] & $aMap[$PlayerPosX + 1][$PlayerPosY] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & $aMap[$PlayerPosX][$PlayerPosY + 1] & $aMap[$PlayerPosX + 1][$PlayerPosY + 1])
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Draw($hGraphic)
    Local $Str, $Str2
    _Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    For $i = 0 To 6 Step 1
    _GDIPlus_ImageDispose($Show[$i][0])
    $Str = StringTrimLeft($Map_Line1,$i)
    $Str2 = StringTrimRight($Str, 6 - $i)
    If StringLen($Str2) > 1 Then Return -1
    Switch $i
    Case 0
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,25,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,25,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,25,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 1
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,75,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,75,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,75,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 2
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,125,25,50,50)
    MsgBox(0,"",$i & " gras")
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,125,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,125,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 3
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,175,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,175,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,175,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 4
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,225,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,225,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,225,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 5
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,275,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,275,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,275,25,50,50)
    EndIf
    EndIf
    EndIf
    Case 6
    If $Str2 == 0 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$gras,325,25,50,50)
    Else
    If $Str2 == 1 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$player,325,25,50,50)
    Else
    If $Str2 == 2 Then
    $Show[$i][0] = _GDIPlus_GraphicsDrawImageRect($hGraphic,$stein,325,25,50,50)
    EndIf
    EndIf
    EndIf
    EndSwitch
    Next
    ;_GDIPlus_GraphicsDrawImage($hGraphics,$Buffer,0,0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_W()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_S()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_D()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_A()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Check_Button($Bt1, $Bt2, $Bt3, $Bt4)
    If $PlayerPosX == 1 Then
    GUICtrlSetState($Bt2,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt2,$GUI_ENABLE)
    EndIf
    If $PlayerPosX == $Width - 2 Then
    GUICtrlSetState($Bt4,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt4,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == 1 Then
    GUICtrlSetState($Bt1,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt1,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == $Height - 2 Then
    GUICtrlSetState($Bt3,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt3,$GUI_ENABLE)
    EndIf
    If $PlayerPosY - 3 < 0 Then
    $Map_Line1 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line1 = $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3]
    EndIf
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY - 2 < 0 Then
    $Map_Line2 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line2 = $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2]
    EndIf
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line3 = $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1]
    EndIf
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line4 = $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0]
    EndIf
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line5 = $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1]
    EndIf
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    EndIf
    If $PlayerPosY + 2 > $Height - 1 Then
    $Map_Line6 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line6 = $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2]
    EndIf
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY + 3 > $Height - 1 Then
    $Map_Line7 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line7 = $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3]
    EndIf
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    EndIf
    EndIf
    GUICtrlSetData($hLabel_Main,$Map_Line1 & @CRLF & _
    $Map_Line2 & @CRLF & _
    $Map_Line3 & @CRLF & _
    $Map_Line4 & @CRLF & _
    $Map_Line5 & @CRLF & _
    $Map_Line6 & @CRLF & _
    $Map_Line7 & @CRLF)
    EndFunc

    [/autoit]


    Nun hab ich aber das Problem, dass wenn ich eine Button drücke möchte ich dass die Aktuelle Map mit allen "Hindernissen" dargestellt wird.
    Wenn ich einen Button drücke führe ich die Funktion _Draw() aus um anhand der _CheckButtons Funktion, die die Map 7 Punkte um den Spieler "Berechnet", alle "Hindernisse" herauszufinden und dann darstellen zu lassen. Ich habe das jetzt nur für die erste Reihe der 7x7 fläche gemacht, sprich die als X markierte Stellen:
    XXXXXXX
    ooooooo
    ooooooo
    ooooooo
    ooooooo
    ooooooo
    ooooooo
    Nur wird das alles nicht auf die Grafik gezeichnet. Ich weiß nicht woran es liegen könnte.

    VIelen Dank für alle Hilfe.

  • Also ich habe es jetzt geschafft das alles gezeichnet wird.

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.8.1
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ID-Liste

    [/autoit] [autoit][/autoit] [autoit]

    -9 => @Error
    -3 => Monster 3
    -2 => Monster 2
    -1 => Monster 1
    0 => Leeres Feld/Gras
    1 => Spieler Position
    2 => Wand/Fels/Berg
    3 => Spieler Upgrade
    4 => Item
    5 => Quest

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------
    #include <GuiConstants.au3>
    #include <GDIPlus.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $Map_Line1,$Map_Line2,$Map_Line3,$Map_Line4,$Map_Line5,$Map_Line6,$Map_Line7
    Global $player, $stein, $gras

    [/autoit] [autoit][/autoit] [autoit]

    $GuiWidth = 400
    $GuiHeight = 500
    $Width = 100
    $Height = 100
    $PlayerPosX = 10
    $PlayerPosY = 10

    [/autoit] [autoit][/autoit] [autoit]

    Dim $aMap[$Width][$Height]
    Dim $Show[7][7]

    [/autoit] [autoit][/autoit] [autoit]

    If FileExists(@ScriptDir & "\Map_X.ini") == 1 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = IniRead("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",0)
    Next
    Next
    Else
    If FileExists(@ScriptDir & "\Map_X.ini") == 0 Then
    For $i = 0 To $Width - 1 Step 1
    For $i2 = 0 To $Height - 1 Step 1
    $aMap[$i][$i2] = 0
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $i2 & "]",$aMap[$i][$i2])
    Next
    Next
    For $i = 0 To $Width - 1 Step 1
    $aMap[$i][0] = 2
    $aMap[$i][$Height - 1] = 2
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][0]",$aMap[$i][0])
    IniWrite("Map_X.ini","Map","$aMap[" & $i & "][" & $Height - 1 & "]",$aMap[$i][$Height - 1])
    Next
    For $i = 0 To $Height - 1 Step 1
    $aMap[0][$i] = 2
    $aMap[$Width - 1][$i] = 2
    IniWrite("Map_X.ini","Map","$aMap[0][" & $i & "]",$aMap[0][$i])
    IniWrite("Map_X.ini","Map","$aMap[" & $Width - 1 & "][" & $i & "]",$aMap[$Width - 1][$i])
    Next
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $aMap[$PlayerPosX][$PlayerPosY] = 1

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("MyGui",$GuiWidth,$GuiHeight)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)

    [/autoit] [autoit][/autoit] [autoit]

    $Bitmap = _GDIPlus_BitmapCreateFromGraphics($GuiWidth, $GuiHeight, $hGraphics)
    $Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

    [/autoit] [autoit][/autoit] [autoit]

    $hBtn_W = GUICtrlCreateButton(ChrW(8593),190,400,30,30)
    $hBtn_A = GUICtrlCreateButton(ChrW(8592),160,430,30,30)
    $hBtn_S = GUICtrlCreateButton(ChrW(8595),190,460,30,30)
    $hBtn_D = GUICtrlCreateButton(ChrW(8594),220,430,30,30)

    [/autoit] [autoit][/autoit] [autoit]

    $hLabel_Main = GUICtrlCreateLabel("test",10,10,380,290)
    GUICtrlSetState($hLabel_Main,$GUI_HIDE)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $gras = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\gras.png")
    $stein = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\stein.png")
    $player = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Data\player.png")

    [/autoit] [autoit][/autoit] [autoit]

    _Draw($hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(10)
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    For $i = 0 To 6 Step 1
    _GDIPlus_ImageDispose($Show[$i][0])
    _GDIPlus_ImageDispose($Show[$i][1])
    _GDIPlus_ImageDispose($Show[$i][2])
    _GDIPlus_ImageDispose($Show[$i][3])
    _GDIPlus_ImageDispose($Show[$i][4])
    _GDIPlus_ImageDispose($Show[$i][5])
    _GDIPlus_ImageDispose($Show[$i][6])
    Next
    _GDIPlus_GraphicsClear($hGraphics)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($Bitmap)
    _GDIPlus_Shutdown()
    Exit
    Case $hBtn_A
    _Btn_A()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    Case $hBtn_D
    _Btn_D()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    Case $hBtn_S
    _Btn_S()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    Case $hBtn_W
    _Btn_W()
    ;_Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    _Draw($Buffer)
    EndSwitch
    ToolTip("X:" & $PlayerPosX & @CRLF & "Y:" & $PlayerPosY & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & $aMap[$PlayerPosX][$PlayerPosY - 1] & $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY] & $aMap[$PlayerPosX][$PlayerPosY] & $aMap[$PlayerPosX + 1][$PlayerPosY] & @CRLF & $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & $aMap[$PlayerPosX][$PlayerPosY + 1] & $aMap[$PlayerPosX + 1][$PlayerPosY + 1])
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Draw($hGraphic)
    Local $Str2, $X = 0, $Y = 0
    _Check_Button($hBtn_W, $hBtn_A, $hBtn_S, $hBtn_D)
    For $i2 = 0 To 6 Step 1
    Switch $i2
    Case 0
    $Y = 25
    Case 1
    $Y = 75
    Case 2
    $Y = 125
    Case 3
    $Y = 175
    Case 4
    $Y = 225
    Case 5
    $Y = 275
    Case 6
    $Y = 325
    EndSwitch
    For $i = 0 To 6 Step 1
    _GDIPlus_ImageDispose($Show[$i][$i2])
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Str2 = -9
    Else
    If $PlayerPosY - 3 + $i2 < 0 Or $PlayerPosY - 3 + $i2 > $Height - 1 Then
    $Str2 = -9
    Else
    $Str2 = $aMap[$PlayerPosX - 3 + $i][$PlayerPosY - 3 + $i2]
    EndIf
    EndIf
    Switch $i
    Case 0
    $X = 25
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 1
    $X = 75
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 2
    $X = 125
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 3
    $X = 175
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 4
    $X = 225
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 5
    $X = 275
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    Case 6
    $X = 325
    If $PlayerPosX - 3 + $i < 0 Or $PlayerPosX - 3 + $i > $Width - 1 Then
    $Show[$i][$i2] = -1
    Else
    If $PlayerPosY - 3 < 0 Or $PlayerPosY - 3 > $Height -1 Then
    $Show[$i][$i2] = -1
    Else
    _Draw_Image($hGraphic,$Str2,$Show[$i][$i2], $X, $Y)
    EndIf
    EndIf
    EndSwitch
    Next
    Next
    _GDIPlus_GraphicsDrawImage($hGraphics,$Bitmap,0,0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Draw_Image($hG, $s, $var, $x, $y)
    If $s == 0 Then
    $var = _GDIPlus_GraphicsDrawImageRect($hG,$gras,$x,$y,50,50)
    Else
    If $s == 1 Then
    $var = _GDIPlus_GraphicsDrawImageRect($hG,$player,$x,$y,50,50)
    Else
    If $s == 2 Then
    $var = _GDIPlus_GraphicsDrawImageRect($hG,$stein,$x,$y,50,50)
    EndIf
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_W()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_S()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosY += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_D()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX += 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Btn_A()
    $aMap[$PlayerPosX][$PlayerPosY] = 0
    $PlayerPosX -= 1
    $aMap[$PlayerPosX][$PlayerPosY] = 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Check_Button($Bt1, $Bt2, $Bt3, $Bt4)
    If $PlayerPosX == 1 Then
    GUICtrlSetState($Bt2,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt2,$GUI_ENABLE)
    EndIf
    If $PlayerPosX == $Width - 2 Then
    GUICtrlSetState($Bt4,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt4,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == 1 Then
    GUICtrlSetState($Bt1,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt1,$GUI_ENABLE)
    EndIf
    If $PlayerPosY == $Height - 2 Then
    GUICtrlSetState($Bt3,$GUI_DISABLE)
    Else
    GUICtrlSetState($Bt3,$GUI_ENABLE)
    EndIf
    If $PlayerPosY - 3 < 0 Then
    $Map_Line1 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line1 = $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3]
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3]
    EndIf
    Else
    $Map_Line1 = $aMap[$PlayerPosX - 3][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 3]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY - 2 < 0 Then
    $Map_Line2 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line2 = $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2]
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2]
    EndIf
    Else
    $Map_Line2 = $aMap[$PlayerPosX - 3][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line3 = $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1]
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1]
    EndIf
    Else
    $Map_Line3 = $aMap[$PlayerPosX - 3][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 1]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line4 = $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0]
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0]
    EndIf
    Else
    $Map_Line4 = $aMap[$PlayerPosX - 3][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY - 0] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY - 0]
    EndIf
    EndIf
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line5 = $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1]
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1]
    EndIf
    Else
    $Map_Line5 = $aMap[$PlayerPosX - 3][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 1] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 1]
    EndIf
    EndIf
    If $PlayerPosY + 2 > $Height - 1 Then
    $Map_Line6 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line6 = $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2]
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2]
    EndIf
    Else
    $Map_Line6 = $aMap[$PlayerPosX - 3][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 2] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 2]
    EndIf
    EndIf
    EndIf
    If $PlayerPosY + 3 > $Height - 1 Then
    $Map_Line7 = ""
    Else
    If $PlayerPosX - 3 < 0 Then
    If $PlayerPosX - 2 < 0 Then
    $Map_Line7 = $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    Else
    If $PlayerPosX + 3 > $Width - 1 Then
    If $PlayerPosX + 2 > $Width - 1 Then
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3]
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3]
    EndIf
    Else
    $Map_Line7 = $aMap[$PlayerPosX - 3][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX - 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 1][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 2][$PlayerPosY + 3] & " " & _
    $aMap[$PlayerPosX + 3][$PlayerPosY + 3]
    EndIf
    EndIf
    EndIf
    GUICtrlSetData($hLabel_Main,$Map_Line1 & @CRLF & _
    $Map_Line2 & @CRLF & _
    $Map_Line3 & @CRLF & _
    $Map_Line4 & @CRLF & _
    $Map_Line5 & @CRLF & _
    $Map_Line6 & @CRLF & _
    $Map_Line7 & @CRLF)
    EndFunc

    [/autoit]


    Nun hab ich aber 2 Probleme:
    1. Die Grafik flackert trotz Buffer.
    2. Das Skript stürzt gerne ab oder hängt sich auf wenn ich es beenden will oder mich manchmal einer Wand nähere.

    Könnt ihr mir vlt. da helfen?

  • Hi,
    wahrscheinlich würde dir gern jemand helfen, aber niemand hat Lust sich durch hunderte Zeilen Code zu wühlen.
    Testen kann man dein Script nämlich nicht, weil du diverse Dateien (Grafiken) nicht zur Verfügung stellst.
    Pack einfach alles, was zur Ausführung deines Scriptes nötig ist in eine *zip-Datei und lade diese hier hoch.
    Dann wird dir sicher auch geholfen ;)