Hallo erst mal,
Seit gestern Abend habe ich angefangen ein kleines Spiel zu schreiben die Story ist fürs erste egal ich brauch nur Hilfe bei den Kollisionen mit den Bäumen.
Hallo erst mal,
Seit gestern Abend habe ich angefangen ein kleines Spiel zu schreiben die Story ist fürs erste egal ich brauch nur Hilfe bei den Kollisionen mit den Bäumen.
Das Skript ist nicht lauffähig und die Anhänge fehlen.
Das macht die Sache nicht einfacher....
Gruß,
UEZ
Danke UEZ für die ehrliche Antwort,
zu dem nicht Laufähigen Skript
1.Das wegen bitte ich dich ja um Hilfe
2.Löst das nicht mein Problem
Gruss Robin
Kollisionsprobleme != nicht lauffähig
minx, das ist ein AutoIt-Forum!
Nein, was damit gemeint ist... Es gibt grundsätzlich 2 Arten von Fehlern beim Programmieren:
Solange dir AutoIt keinen Fehler auswirft, handelt es sich um einen Logikfehler.
While True
WEnd
MsgBox(0, "", "Nachricht!")
Das ist ein Logikfehler, denn die MsgBox wird niemals aufgerufen.
EmEsGeBox(0, "", "Nachricht! ;)")
DAS ist ein Syntaxfehler, da die Funktion EmEsGeBox nicht vorhanden ist.^^
Du gibst an, dass dein Skript einen Logikfehler hat (Da die Kollision nicht funktioniert).
UEZ meinte jedoch, dass ein Syntaxfehler vorliegt, daher das Skript sich garnicht erst ausführen lässt.
lg
Ich weiß aber bei mir funktioniert es einwandfrei bis auf die Kollisionen
Das bekomme ich, wenn ich dein Skript starte:
ZitatAlles anzeigen
"C:\_Downloads\Game.au3"(464,1) : error: syntax error
WEnd
^
"C:\_Downloads\Game.au3"(10,28) : error: _end(): undefined function.
OnAutoItExitRegister("_end")
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\_Downloads\Game.au3 - 2 error(s), 0 warning(s)
!>22:17:37 AU3Check ended. Press F4 to jump to next error.rc:2
>Exit code: 2 Time: 0.518
Und wie gesagt, fehlen die gesamten Bilder. Wie sollen wir dir Helfen, wenn wir nichts sehen können. Ein bisschen mehr Mühe solltest du dir schon geben, ansonsten wird dir nicht gut geholfen.
Gruß,
UEZ
Danke UEZ für die ehrliche Antwort,
Das Darlegen von Fakten ist immer ehrlich oder?
Hier sindl die Bilder
Du gibst wirklich nur das nötigste an Information raus ich persönlich will dir jetzt nicht unbedingt alles aus der Nase ziehen.
Ich denke als erstes solltest du dir mal den Teil ansehen in dem du die Kollision bereitstellst und dir Gedanken machen WIESO es nicht klappt.
Bisher beschränken sich deine Informationen auf 2 Linien in denen du im Grunde genommen den Titel 1:1 wiedergibst: es klappt einfach nicht und du willst dir keine Gedanken machen wieso.
Aus dem Zitat von UEZ schliesse ich ausserdem, dass die Funktion _end() aufgerufen wird, im Code aber nicht definiert wird.
Gib doch bitte mal einen ("anständigen") kompletten Problembericht
Hier einmal das lauffähige Skript:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GdiPlus.au3>
#include <Misc.au3>
#include <file.au3>
OnAutoItExitRegister("_end")
[/autoit] [autoit][/autoit] [autoit]Global $Baum, $Eisen, $Laden, $weg, $x, $y
[/autoit] [autoit][/autoit] [autoit]$x = 0
$y = 0
$f1x = 0
$f1y = 40
$Ep = IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "EP", "Not Found")
$Leben = IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Leben", "Not Found")
$Geld = IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Geld", "Not Found")
$Arbeit = IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Arbeit", "Not Found")
$Form1 = GUICreate("X-The Game", 1123, 633, 185, 123, $WS_POPUP)
$Progress1 = GUICtrlCreateProgress(904, 60, 209, 17)
GUICtrlSetData($Progress1, $Leben)
$Leben_l = GUICtrlCreateLabel("Leben", 976, 80, 34, 17)
$Ep_l = GUICtrlCreateLabel("EP:", 976, 120, 34, 17)
$Ep_erg = GUICtrlCreateLabel("", 1020, 120, 34, 17)
GUICtrlSetData($Ep_erg, $Ep)
$Geld_l = GUICtrlCreateLabel("Geld:", 976, 180, 34, 17)
$Geld_erg = GUICtrlCreateLabel("", 1020, 180, 34, 17)
GUICtrlSetData($Geld_erg, $Geld)
$arbeit_l = GUICtrlCreateLabel("Arbeit:", 976, 240, 34, 17)
$Arbeit_erg = GUICtrlCreateLabel("", 1020, 240, 120, 17)
GUICtrlSetData($Arbeit_erg, $Arbeit)
$Button1 = GUICtrlCreateButton("Speichern", 920, 512, 185, 33)
GUISetState(@SW_SHOW)
Func _Save()
IniWrite(@ScriptDir & "\INI\Data.Ini", "DATA", "Leben", "" & GUICtrlRead($Progress1) & "")
IniWrite(@ScriptDir & "\INI\Data.Ini", "DATA", "EP", "" & GUICtrlRead($Ep_erg) & "")
IniWrite(@ScriptDir & "\INI\Data.Ini", "DATA", "Geld", "" & GUICtrlRead($Geld_erg) & "")
IniWrite(@ScriptDir & "\INI\Data.Ini", "DATA", "Arbeit", "" & GUICtrlRead($Arbeit_erg) & "")
EndFunc ;==>_Save
;=====================GDIPlus===========================================;
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]If _GDIPlus_Startup() = 1 Then
_LoadMap()
EndIf
$Player = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\NPC\Skin.gif")
$bk = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Map\Map.gif")
$height = _GDIPlus_ImageGetHeight($Player)
$widht = _GDIPlus_ImageGetWidth($Player)
$verhaelnis = $height / $widht
$btn_exit = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Buttons\Schließen.gif")
$btn_arbeit = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Buttons\Arbeit.gif")
$btn_world = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Buttons\Erde.gif")
$btn_bk = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Buttons\Feld.gif")
$graphic = _GDIPlus_GraphicsCreateFromHWND($Form1)
$bitmap = _GDIPlus_BitmapCreateFromGraphics(900, 633, $graphic)
$buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
;Map Load Bar anfang
[/autoit] [autoit][/autoit] [autoit]Func _LoadMap()
[/autoit] [autoit][/autoit] [autoit]Dim $Feld[10] = ["Eisen", "Laden", "Laden", "Eisen", "Eisen", "Eisen", "Bauer", "Ritter", "Holzfäller", "Eindringling"]
IniWrite(@ScriptDir & "\INI\Data.ini", "DATA", "Map", $Feld[Random(0, 9, 1)])
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Baum") = "Baum" Then
_Baum()
EndIf
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Laden") = "Laden" Then
_Laden()
EndIf
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Laden") = "Laden" Then
_Baum()
EndIf
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Weg") = "Weg" Then
_Weg()
EndIf
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Weg") = "Weg" Then
_Baum()
EndIf
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Eisen") = "Eisen" Then
_Eisen()
EndIf
If IniRead(@ScriptDir & "\INI\Data.ini", "DATA", "Map", "Eisen") = "Eisen" Then
_Baum()
EndIf
EndFunc ;==>_LoadMap
Func _Baum()
_Weg()
$Baum = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Terrain\Baum.gif")
EndFunc ;==>_Baum
Func _Laden()
$Laden = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Terrain\Haus3.gif")
EndFunc ;==>_Laden
Func _Weg()
$weg = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Terrain\Stein3.gif")
EndFunc ;==>_Weg
Func _Eisen()
$Eisen = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Pics\Terrain\Eisen.gif")
EndFunc ;==>_Eisen
;Map Load Bar ende
[/autoit] [autoit][/autoit] [autoit];Arbeit Funktion Anfang
Func _Arbeit()
EndFunc ;==>_Arbeit
;Arbeit Funktion ende
While 1
$mouse = GUIGetCursorInfo()
;=================Button1=================================
If IsArray($mouse) Then
If $mouse[0] > 840 And $mouse[1] < 20 And _IsPressed(01) Then
Exit
EndIf
EndIf
;=======================Button2==============================
If IsArray($mouse) Then
If $mouse[0] > 780 And $mouse[1] < 20 And _IsPressed(01) Then
_Arbeit()
EndIf
EndIf
;========================Button3=============================
If IsArray($mouse) Then
If $mouse[0] > 720 And $mouse[1] < 20 And _IsPressed(01) Then
_LoadMap()
EndIf
EndIf
;=======================Ende Buttons=========================
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Save()
EndSwitch
Select
Case _IsPressed(25) And Not $x <= 0
$x -= 40
;Anfang Kolisionen
If $x = 40 And $y = 40 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 40 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$x = -40 + 80
EndIf
If $x = 40 And $y = 120 Then
$y = -40 + 80
EndIf
If $x = 40 And $y = 480 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$y = -40 + 40
EndIf
If $x = 240 And $y = 320 Then
$y = -40 + 40
EndIf
;Ende Colisionen
Case _IsPressed(26) And Not $y <= 0
$y -= 40
;Anfang Kolisionen
If $x = 40 And $y = 40 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 40 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$y = -40 + 40
EndIf
If $x = 240 And $y = 320 Then
$y = -40 + 40
EndIf
;Ende Colisionen
Case _IsPressed(27) And $x <= 833
$x += 40
;Anfang Kolisionen
If $x = 40 And $y = 40 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 40 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$y = -40 + 40
EndIf
If $x = 240 And $y = 320 Then
$y = -40 + 40
EndIf
;Ende Colisionen
Case _IsPressed(28) And $y <= 540
$y += 40
;Anfang Kolisionen
If $x = 40 And $y = 40 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 40 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 120 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 480 Then
$y = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$x = -40 + 40
EndIf
If $x = 40 And $y = 160 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$y = -40 + 40
EndIf
If $x = 120 And $y = 240 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$x = -40 + 40
EndIf
If $x = 440 And $y = 280 Then
$y = -40 + 40
EndIf
If $x = 240 And $y = 320 Then
$y = -40 + 40
EndIf
;Ende Colisionen
EndSelect
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDrawImageRect($buffer, $bk, 0, 0, 900, 633)
_GDIPlus_GraphicsDrawImageRect($buffer, $btn_exit, 860, 0, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $btn_arbeit, 800, 0, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $btn_bk, 740, 0, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $btn_world, 740, 0, 40, 40)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 0, 0, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 40, 0, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 0, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 40, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 80, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 120, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 200, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 240, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 280, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 320, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 360, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 400, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 440, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 480, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 520, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 560, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 80, 600, 40, 40)
;Rects Anfang
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 120, 80, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 160, 80, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 200, 80, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 240, 80, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 280, 80, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 280, 120, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 280, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 280, 200, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 320, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 360, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 400, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 440, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 480, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 520, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 560, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 600, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 640, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 680, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 720, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 760, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 800, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 840, 160, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $weg, 880, 160, 40, 40)
;Rechts Ende
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_GDIPlus_GraphicsDrawImageRect($buffer, $Player, $x, $y, 35, 35 * $verhaelnis)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 40, 40, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 40, 120, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 40, 480, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 40, 160, 40, 40);5
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 120, 240, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 440, 280, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Baum, 240, 320, 40, 40);
;_GDIPLus_GraphicsDrawImageRect($buffer, $Baum,160,360,40,40);10
;_GDIPLus_GraphicsDrawImageRect($buffer, $Baum,200,400,40,40)
;_GDIPLus_GraphicsDrawImageRect($buffer, $Baum,280,440,40,40)
;_GDIPLus_GraphicsDrawImageRect($buffer, $Baum,400,40,40,40)
;_GDIPLus_GraphicsDrawImageRect($buffer, $Baum,320,80,40,40)
;_GDIPLus_GraphicsDrawImageRect($buffer, $Baum,360,40,40,40);15
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_GDIPlus_GraphicsDrawImageRect($buffer, $Eisen, 40, 260, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Eisen, 400, 260, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Eisen, 40, 360, 40, 40)
_GDIPlus_GraphicsDrawImageRect($buffer, $Eisen, 160, 360, 40, 40)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_GDIPlus_GraphicsDrawImageRect($buffer, $Laden, 260, 230, 80, 80)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)
WEnd
Func _end()
_GDIPlus_GraphicsDispose($graphic)
_GDIPlus_GraphicsDispose($buffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_ImageDispose($Player)
_GDIPlus_ImageDispose($Baum)
_GDIPlus_ImageDispose($weg)
_GDIPlus_ImageDispose($Eisen)
_GDIPlus_ImageDispose($Laden)
_GDIPlus_ImageDispose($btn_exit)
_GDIPlus_ImageDispose($btn_arbeit)
_GDIPlus_ImageDispose($btn_world)
_GDIPlus_ImageDispose($btn_bk)
_GDIPlus_ImageDispose($bk)
_GDIPlus_Shutdown()
EndFunc ;==>_end
Um das eigentliche Problem kann ich mich nicht kümmern da mein Display nicht alle Inalte darstellen kann. Im Anhang Skript und Bilder zusammen.
mfg autoBert
Danke autoBert
aber wer kann mir bei meinem eigentlichen Problem helfen