Bewegen eines Hindernisses in GDI+

  • Hey ich hab mir das spiel Doodle Jump angeguckt und finde es einfach super. mich würde jetzt aber interessieren wie ihr den hintergrund erstellt habt ohne rand (wenn man die bilder nicht öffnen lässt ist da nur dieser weisse kasten das meine ich)
    danke im vorraus
    BadBunny

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

    4 Mal editiert, zuletzt von BadBunny (7. Juni 2010 um 19:30)

  • ah okay und dann dadrunter GUISetState(@SW_SHOW)
    danke
    und wie lässt man bestimmte bilder verschwinden nach einer bestimmten zeit und / oder ein bild erscheinen was vorher noch nicht da war?

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

    Einmal editiert, zuletzt von BadBunny (7. Juni 2010 um 15:08)

  • Schau dir in der Hilfedatei mal die Abteilung GUI an.
    Um ein Bild zu zeichnen verwendest du:

    [autoit]

    GUICtrlSetImage ( controlID, filename [, iconname [, icontype]] )

    [/autoit]
  • ja ich hab nen script hier :

    Spoiler anzeigen
    [autoit]


    HotKeySet ("b","beenden")
    #include <GuiConstants.au3>
    #include <WindowsConstants.au3>
    #include <GdiPlus.au3>;das include
    #include <Misc.au3>
    $Gui = GuiCreate("Titel",1365,767,0,0,$WS_POPUP)
    GUISetState(@SW_SHOW)
    Func beenden ()
    Exit
    EndFunc

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

    OnAutoItExitRegister("_end")

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

    $x = 0;x und y deklarieren
    $y = 0

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

    $x1 = 300
    $y1 = 300
    _GDIPlus_Startup() ;Gdi starten
    $weiss = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\weiss2.png")
    $figur = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\figur.png")
    $hinderniss = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\.png")
    $ziel = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\ziel.png")
    $height = _GDIPlus_ImageGetHeight($figur)
    $width = _GDIPlus_ImageGetWidth($figur)
    $verhaelnis = $height / $width
    $graphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics(1365, 767, $graphic)
    $buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    $buffer1 = _GDIPlus_ImageGetGraphicsContext($bitmap)

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

    While 1
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    Select
    Case _IsPressed(25) and not $x <= 0 ; nach links
    $x -= 20
    Case _IsPressed(26) and not $y <= 0; nach oben
    $y -= 20
    Case _IsPressed(27) and $x <= 1265 ; nach rechts
    $x += 20
    Case _isPressed(28) and $y <= 667 ; nach unten
    $y += 20
    EndSelect

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



    _GDIPlus_GraphicsDrawImageRect($buffer,$weiss,0, 0, 1365, 766)
    _GDIPlus_GraphicsDrawImageRect($buffer,$hinderniss,$x1, $y1, 100, 100)
    _GDIPlus_GraphicsDrawImageRect ($buffer, $ziel, 1268, 670, 100,100 )
    _GDIPlus_GraphicsDrawImageRect($buffer,$figur,$x,$y,100, 100 * $verhaelnis)
    _GDIPlus_GraphicsDrawImage($graphic, $bitmap, 0, 0)

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

    If $x >= 1268 and $x <= 1368 and $y >= 670 and $y <=770 Then
    MsgBox (0,"Winn","Du hast gewonnen.")
    Exit
    EndIf

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

    WEnd
    Func _end ();die Exit funktion
    _GDIPlus_GraphicsDispose($graphic);Grafik Objekt freigeben
    _GDIPlus_GraphicsDispose($buffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_ImageDispose ($hinderniss)
    _GDIPlus_ImageDispose ($weiss)
    _GDIPlus_ImageDispose($figur);Bild Objekt 1 freigeben
    _GDIPlus_ImageDispose($ziel);Bild Objekt 2 freigeben
    _GDIPlus_Shutdown();Ressourcen freigeben
    Sleep (10)
    EndFunc

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

    So geht das auch aber wie mach ich jetzt z.B. das das hinderniss sich bewegt oder das bestimmte sachen kommen / gehen???

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • Er meinte doch nur die GUI, nicht das Bild

    Er hat aber Bild geschrieben:

    und wie lässt man bestimmte bilder verschwinden nach einer bestimmten zeit und / oder ein bild erscheinen was vorher noch nicht da war?

    ubuntu wie soll ich GDI+ denn lernen!!!???

    Es gibt genügend Tutorials, und außerdem macht Ubuntu gerade auch eines KLICK


    //Edit:

    Zitat

    So geht das auch aber wie mach ich jetzt z.B. das das hinderniss sich bewegt oder das bestimmte sachen kommen / gehen???

    Das geht von den Berechnungen her genau so, wie deine _IsPressed() Abfragen.

  • ich hab das schon probiert, bin aber mal wieder zu doof dafür... wenn du dir den script mal genau anguckst wirst du sehen das der sehr dem aus dem tutoriel ähnelt , weil es meine vorlage war.
    könntest du denn pls ein kleines

    [autoit]


    select
    case $x1 = 300
    $x1 += 10
    endselect

    [/autoit]


    oder so machen und das der dann z.b. bei 390 wieder zurück geht? bitte bekomme das nicht hin...

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

  • @bad bunny:
    Ok ich nehm das von oben zurück, du scheinst dich wirklich zu bemühen (hoffe ich zumindest) *nie den glauben an das gute im menschen aufgeben*

    mfg Ubuntu

  • danke :)
    ich hatte da sowas stehen wie

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

    select
    case $x1 = 300 or $x1 >= 300 and $y1 = 300
    $x1 += 10
    case $x1 = 400
    $y1 -= 1
    case $x1 =400 or $x1 >= 400 and $y1 = 299
    $x1 -= 10
    case $x1 = 300 and $y1 = 299
    $y1 += 1
    endselect

    [/autoit]

    das ist alles noch sehr unsicher...

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

    Einmal editiert, zuletzt von BadBunny (7. Juni 2010 um 15:54)

  • Die select-case Methode bewirkt, dass du deine Figur nur nach rechts, links, oben oder unten bewegen kannst, nicht aber diagonal.
    Wenn die Figur auch diagonal bewegt werden soll, dann solltest du s so machen:

    [autoit]


    If _IsPressed(25) and not $x <= 0 then $x -= 20 ; nach links
    If _IsPressed(26) and not $y <= 0 then $y -= 20; nach oben
    If _IsPressed(27) and $x <= 1265 then $x += 20; nach rechts
    If _isPressed(28) and $y <= 667 then $y += 20 ; nach unten

    [/autoit]
  • oder so dann bleibt das hinderniss aber stehen... :

    [autoit]


    Select
    case $x1 = 300 or $x1 >= 300 and $x1 <= 401 and $y1 = 300
    $x1 += 10
    case $x1 = 400
    $y1 -= 1
    case $x1 =400 or $x1 >= 400 and $y1 = 299
    $x1 -= 10
    case $x1 = 300 and $y1 = 299
    $y1 += 1
    Endselect

    [/autoit]


    Bitte sagen wie ichs machen muss.

    mfg BB

    "IF YOU'RE GOING TO KILL IT
    OPEN SOURCE IT!"

    by Phillip Torrone

    Zitat von Shoutbox

    [Heute, 11:16] Andy: ....böseböseböseböse....da erinnere ich mich daran, dass man den Puschelschwanz eines KaRnickels auch "Blume" nennt....ob da eins zum anderen passt? :rofl: :rofl: :rofl: :rofl:

    https://autoit.de/index.php?page…leIt#post251138

    Neon Snake

    2 Mal editiert, zuletzt von BadBunny (7. Juni 2010 um 19:28)