Hallo,
Hier ist erstmal mein Script:
Spoiler anzeigen
Opt("GUIOnEventMode", 1)
#include <./au3/GDIpProgress.au3>
$p_x = 300
$p_y = 300
$e_x = 800
$e_y = 300
$action = False
$stand = "right"
$enemystate = "live"
HotKeySet("{ESC}", "close")
HotKeySet("d", "walk_right")
HotKeySet("a", "walk_left")
HotKeySet("w", "walk_up")
HotKeySet("s", "walk_down")
HotKeySet("{SPACE}", "action")
;~ HotKeySet("r", "fireball")
$gui = GUICreate("Wave FightEngine", 1000, 868)
;~ GUISetBkColor(0xeedd82)
GUISetBkColor(0xFFFFFF)
$player = GUICtrlCreatePic("./poses/stand_right.gif", $p_x, $p_y, 24, 62, $WS_EX_TOPMOST)
$balken = GUICtrlCreatePic("./img/balken.gif", 0, 804, 1000, 64)
$w = GUICtrlCreatePic("./img/w.gif", 0, 804, 62, 64)
$progress1 = _ProgressCreate(70, 804, 200, 32, 0x3cb371)
$progress2 = _ProgressCreate(70, 836, 200, 32, 0x6495ed, 0x6495ed)
_ProgressSet($progress1, IniRead("./ini/stats.ini", "allgemein", "leben", 100))
_ProgressSet($progress2, IniRead("./ini/stats.ini", "allgemein", "mana", 100))
GUISetState(@SW_SHOW)
$mana = IniRead("./ini/stats.ini", "allgemein", "mana", 100)
$life = IniRead("./ini/stats.ini", "allgemein", "leben", 100)
read()
terrain_secretiland1()
While 1
WEnd
Func close()
Exit
EndFunc
Func terrain_secretiland1()
Global $location = "secretisland1"
;~ $terrain = GUICtrlCreatePic("./terrain/innen_house1.gif", 0, 0, 1000, 804)
Global $house1 = GUICtrlCreatePic("./terrain/haus1.gif", 600, 10, 152, 272)
GUICtrlSetState($house1, $WS_EX_TOPMOST)
EndFunc
Func house_secretisland1()
Global $location = "secretislandhouse1"
GUICtrlDelete($house1)
$innen1 = GuictrlcreatePic("./terrain/innen_house1.gif", 0, 0, 1000, 804)
$p_x = 480
$p_y = 500
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/stand_up.gif", $p_x, $p_y, 32, 62)
$npc1 = GUICtrlCreatePic("./char/tutor.gif", 480, 260, 32, 58)
GUICtrlSetState($player, $WS_EX_TOPMOST)
GUICtrlSetState($npc1, $WS_EX_TOPMOST)
EndFunc
Func action()
If $location = "secretisland1" Then
If ($p_x < 695) AND ($p_x + 24 > 660) AND ($p_y < 10 + 272) Then house_secretisland1()
EndIf
EndFunc
Func walk_right()
If $action = False Then
$action = True
GUICtrlSetState ($Player, $GUI_ONTOP)
GUICtrlSetImage ($Player, "./poses/walk_right_right.gif")
For $i = 1 To 5
$p_x += $i
check_p_x1()
GUICtrlSetPos ($Player, $p_x, $p_y, 24, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/walk_right_left.gif")
For $i = 1 To 5
$p_x += $i
check_p_x1()
GUICtrlSetPos ($Player, $p_x, $p_y, 24, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/stand_right.gif")
$stand = "right"
$action = False
Else
Return
EndIf
EndFunc
Func check_p_x1()
If $p_x > 980 Then $p_x = 980
If $location = "secretisland1" Then
If ($p_x > 576) AND ($p_y + 62 < 272) AND ($p_x < 752) Then $p_x = 576
EndIf
If $location = "secretislandhouse1" Then
If $p_x > 737 - 24 Then $p_x = 710
EndIf
EndFunc
Func walk_left()
If $action = False Then
$action = True
GUICtrlSetState ($Player, $GUI_ONTOP)
GUICtrlSetImage ($Player, "./poses/walk_left_right.gif")
For $i = 1 To 5
$p_x -= $i
check_p_x2()
GUICtrlSetPos ($Player, $p_x, $p_y, 24, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/walk_left_left.gif")
For $i = 1 To 5
$p_x -= $i
check_p_x2()
GUICtrlSetPos ($Player, $p_x, $p_y, 24, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/stand_left.gif")
$stand = "left"
$action = False
Else
Return
EndIf
EndFunc
Func check_p_x2()
If $p_x < 0 Then $p_x = 0
If $location = "secretisland1" Then
If ($p_x < 752) AND ($p_y + 62 < 272) AND ($p_x > 752) Then $p_x = 752
EndIf
If $location = "secretislandhouse1" Then
If $p_x < 260 Then $p_x = 260
EndIf
EndFunc
Func walk_up()
If $action = False Then
$action = True
GUICtrlSetState ($Player, $GUI_ONTOP)
GUICtrlSetImage ($Player, "./poses/walk_up_right.gif")
For $i = 1 To 5
$p_y -= $i
check_p_y1()
GUICtrlSetPos ($Player, $p_x, $p_y, 32, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/walk_up_left.gif")
For $i = 1 To 5
$p_y -= $i
check_p_y1()
GUICtrlSetPos ($Player, $p_x, $p_y, 32, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/stand_up.gif")
$stand = "up"
$action = False
Else
Return
EndIf
EndFunc
Func check_p_y1()
If $p_y < 0 Then $p_y = 0
If $location = "secretisland1" Then
If ($p_y < 282 - 62) AND ($p_x + 32 > 600) AND ($p_x < 752) Then $p_y = 282 - 62
EndIf
If $location = "secretislandhouse1" Then
If $p_y < 259 Then $p_y = 260
EndIf
EndFunc
Func walk_down()
If $action = False Then
$action = True
GUICtrlSetState ($Player, $GUI_ONTOP)
GUICtrlSetImage ($Player, "./poses/walk_down_right.gif")
For $i = 1 To 5
$p_y += $i
check_p_y2()
GUICtrlSetPos ($Player, $p_x, $p_y, 32, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/walk_down_left.gif")
For $i = 1 To 5
$p_y += $i
check_p_y2()
GUICtrlSetPos ($Player, $p_x, $p_y, 32, 62)
Sleep(10)
Next
GUICtrlSetImage ($Player, "./poses/stand_down.gif")
$stand = "down"
$action = False
Else
Return
EndIf
EndFunc
Func check_p_y2()
If $p_y > 740 Then $p_y = 740
If $location = "secretislandhouse1" Then
If $p_y > 562 - 62 Then $p_y = 500
EndIf
EndFunc
Func sword()
If $action = False Then
If $stand = "left" Then
$action = True
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_sword1.gif", $p_x, $p_y, 52, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_sword2.gif", $p_x, $p_y, 48, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_sword3.gif", $p_x, $p_y, 32, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_sword4.gif", $p_x - 25, $p_y, 60, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
get_sword($p_x - 25, $p_y, 60, 62, $e_x, $e_y, 24, 62)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_sword5.gif", $p_x - 29, $p_y, 64, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
get_sword($p_x - 29, $p_y, 64, 62, $e_x, $e_y, 24, 62)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_sword6.gif", $p_x - 23, $p_y, 58, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
get_sword($p_x - 23, $p_y, 58, 62, $e_x, $e_y, 24, 62)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/stand_left.gif", $p_x, $p_y, 24, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
$action = False
ElseIf $stand = "right" Then
$action = True
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_sword1.gif", $p_x - 27, $p_y, 52, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_sword2.gif", $p_x - 21, $p_y, 48, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_sword3.gif", $p_x, $p_y, 32, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_sword4.gif", $p_x, $p_y, 60, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
get_sword($p_x, $p_y, 60, 62, $e_x, $e_y, 24, 62)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_sword5.gif", $p_x, $p_y, 64, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
get_sword($p_x, $p_y, 64, 62, $e_x, $e_y, 24, 62)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_sword6.gif", $p_x, $p_y, 58, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
get_sword($p_x, $p_y, 58, 62, $e_x, $e_y, 24, 62)
Sleep(80)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/stand_right.gif", $p_x, $p_y, 24, 62)
GUICtrlSetState($player, $WS_EX_TOPMOST)
$action = False
EndIf
Else
Return
EndIf
EndFunc
Func fireball()
If $action = False Then
If mana_take(10) = False Then Return
If $stand = "right" Then
$action = "true"
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/right_fire.gif", $p_x, $p_y, 40, 62)
Sleep(100)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/stand_right.gif", $p_x, $p_y, 24, 62)
$s_x = $p_x + 24
$spell = GUICtrlCreatePic("./poses/attack/fireball_right.gif", $s_x, $p_y, 51, 31)
For $i = 0 To 20
Sleep(20)
$s_x += 10
GUICtrlSetPos($spell, $s_x, $p_y)
Next
GUICtrlDelete($spell)
ElseIf $stand = "left" Then
$action = "true"
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/attack/left_fire.gif", $p_x, $p_y, 40, 62)
Sleep(100)
GUICtrlDelete($player)
$player = GUICtrlCreatePic("./poses/stand_left.gif", $p_x, $p_y, 24, 62)
$s_x = $p_x - 24
$spell = GUICtrlCreatePic("./poses/attack/fireball_left.gif", $s_x, $p_y, 51, 31)
For $i = 0 To 20
Sleep(20)
$s_x -= 10
GUICtrlSetPos($spell, $s_x, $p_y)
Next
GUICtrlDelete($spell)
EndIf
$action = False
Else
Return
EndIf
EndFunc
;~ Func zombie()
;~ If $enemystate = "live" Then
;~ $e_x -= 10
;~ If $e_x < 0 Then $e_x = 0
;~ GUICtrlDelete($enemy)
;~ $enemy = GUICtrlCreatePic("./poses/enemy/zombie/walk_left_right.gif", $e_x, $e_y, 24, 62)
;~ $e_x -= 10
;~ If $e_x < 0 Then $e_x = 0
;~ Sleep(150)
;~ GUICtrlDelete($enemy)
;~ $enemy = GUICtrlCreatePic("./poses/enemy/zombie/walk_left_left.gif", $e_x, $e_y, 24, 62)
;~ Sleep(150)
;~ GUICtrlDelete($enemy)
;~ $enemy = GUICtrlCreatePic("./poses/enemy/zombie/stand_left.gif", $e_x, $e_y, 24, 62)
;~ Sleep(1000)
;~ Else
;~ Return
;~ EndIf
;~ EndFunc
Func get_sword($x1, $y1, $b1, $h1, $x2, $y2, $b2, $h2)
If ($x1 + $b1 > $x2 And $y1 + $h1 > $y2 And $x1 < $x2 + $b2 And $y1 < $y2 + $h2) Then
If $enemystate = "live" Then
GUICtrlDelete($enemy)
$enemy = GUICtrlCreatePic("./poses/enemy/zombie/death1.gif", $e_x, $e_y + 42, 64, 24)
$enemystate = "death"
EndIf
Else
Return
EndIf
EndFunc
Func mana_take($take)
If $mana - $take < 0 Then
Return False
Else
Return True
$mana -= $take
write()
EndIf
EndFunc
Func read()
$mana = IniRead("./ini/stats.ini", "allgemein", "mana", 100)
$life = IniRead("./ini/stats.ini", "allgemein", "leben", 100)
EndFunc
Func write()
IniWrite("./ini/stats.ini", "allgemein", "mana", $mana)
IniWrite("./ini/stats.ini", "allgemein", "leben", $life)
_ProgressSet($progress1, IniRead("./ini/stats.ini", "allgemein", "leben", 100))
_ProgressSet($progress2, IniRead("./ini/stats.ini", "allgemein", "mana", 100))
EndFunc
Mein Problem: Wenn $player vor $house1 rennt, steht der Player quasi hinter dem Haus, also das Haus ist Vor der Figur.
Mit GuiSetState($Player, $WS_EX_TOPMOST)geht es auch nicht.
Hilfe wär nett,
Mfg