Hallo,
ich habe einen Script, gehört nicht mir, möchte ich aber gerne abändern weil er mir so nicht gefällt. Ist schon einiges dran gemacht wurden.
Hier erstmal der Script:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=x.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
==Copyright TheShadowAE
==Edierer Wuseum
_GDIPlus_Startup()
#Region ### START Koda GUI section ### Form=
global $title="Run!"
global $winx=323
global $winy=238
$Form1 = GUICreate($title, $winx, $winy, 192, 124)
GUISetIcon("x.ico")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
if FileExists(@ScriptDir&"\mr.png")=0 then
msgbox(48,"Fehler","Bild(er) wurde(n) nicht gefunden")
Exit
EndIf
for $x=1 to 10
if FileExists(@ScriptDir&"\m"&$x&".png")=0 Then
msgbox(48,"Fehler","Bild(er) wurde(n) nicht gefunden")
Exit
EndIf
Next
dim $img[10]
$img[0]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m1.png")
$img[1]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m2.png")
$img[2]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m3.png")
$img[3]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m4.png")
$img[4]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m5.png")
$img[5]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m6.png")
$img[6]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m7.png")
$img[7]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m8.png")
$img[8]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m9.png")
$img[9]=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\m10.png")
global $imgrock=_GDIPlus_ImageLoadFromFile(@ScriptDir&"\mr.png")
global $gra=_GDIPlus_GraphicsCreateFromHWND($Form1)
global $buffer=_GDIPlus_BitmapCreateFromGraphics($winx,$winy,$gra)
global $backgra=_GDIPlus_ImageGetGraphicsContext($buffer)
global $pen=_GDIPlus_PenCreate(0xFF0000BB,3)
_GDIPlus_GraphicsSetSmoothingMode($backgra,2)
global $imgx=_GDIPlus_ImageGetWidth($img[0])
global $imgy=_GDIPlus_ImageGetHeight($img[0])
global $xspeed=-3
global const $xnorm=-3
global $yjump=-5
global $gravs=13
global const $maxgrav=2
global const $ynorm=0
global $yspeed=0
global $mx=($winx/2)-($imgx/2)
global $my=($winy/2)-$imgy
global $score=0
dim $line[5][2][2]
global $timer=TimerInit()
global $rockets=0
global $rocket=TimerInit()
global $rocks=0
global $ron=0
global $skill=0
$line[0][0][0]=0
$line[0][0][1]=($winy/2)
$line[0][1][0]=$winx
$line[0][1][1]=($winy/2)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE,"ende")
$sprite=TimerInit()
$sksp=0
$image=0
While 1
for $x=0 to UBound($line,1)-1
if $line[$x][1][0]<=0 then newrand($x)
Next
if WinActive($title)=0 then
WinWaitActive($title)
$skill=TimerDiff($timer)
EndIf
_WinAPI_RedrawWindow($Form1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
_GDIPlus_GraphicsClear($backgra,0xFFFFFFFF)
$d=TimerDiff($sprite)-$sksp
if $d>=25 Then
$sksp=TimerDiff($sprite)
$image+=1
EndIf
if $image>ubound($img)-1 Then $image=0
if $ron=0 Then
_GDIPlus_GraphicsDrawImage($backgra,$img[$image],$mx,$my)
Else
_GDIPlus_GraphicsDrawImage($backgra,$imgrock,$mx,$my)
EndIf
for $x=0 to UBound($line,1)-1
_GDIPlus_GraphicsDrawLine($backgra,$line[$x][0][0],$line[$x][0][1],$line[$x][1][0],$line[$x][1][1],$pen)
Next
_GDIPlus_GraphicsDrawString($backgra,"Punke: "&round($score,0),5,5,"Arial",12)
_GDIPlus_GraphicsDrawString($backgra,"Hilfe | "&$rockets,5,20,"Arial",10)
_GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$winx,$winy)
$yspeed=grav($yspeed,$gravs)
if $yspeed>$maxgrav then $yspeed=$maxgrav
for $x=0 to UBound($line,1)-1
if $line[$x][0][0]<=$mx+$imgx and $line[$x][1][0]>=$mx Then
if ($my+$imgy<=$line[$x][0][1] and $my+$imgy+2>=$line[$x][0][1]) or ($my+$imgy+$yspeed<=$line[$x][0][1] and $my+$imgy+$yspeed+2>=$line[$x][0][1]) then
$yspeed=0
if _IsPressed("26") Then $yspeed=$yjump
EndIf
EndIf
Next
if _IsPressed("27") Then
if $rockets>0 and $ron=0 Then
$rockets-=1
$rocksc=TimerDiff($rocket)
$ron=1
$xspeed=-7
EndIf
EndIf
if $ron=1 Then
if TimerDiff($rocket)-$rocksc>3000 Then
$ron=0
if $score<0 then $xspeed=$xnorm
if $score>=0 then $xspeed=$xnorm+1
if $score>=0 then $xspeed=$xnorm+2
Else
$yspeed=-100
$xspeed=-100
EndIf
EndIf
if TimerDiff($rocket)-$rocks>0 Then
$rockets+=0
$rocks=TimerDiff($rocket)
EndIf
$my+=$yspeed
if $my+$imgy>$winy then death()
$score+=TimerDiff($timer)-$skill
$skill=TimerDiff($timer)
for $x=0 to UBound($line,1)-1
$line[$x][0][0]+=$xspeed
$line[$x][1][0]+=$xspeed
Next
if $score>= 0 then $xspeed=-4
if $score>= 0 then $xspeed=-5
sleep(10)
WEnd
func ende()
_GDIPlus_ImageDispose($imgrock)
for $x=0 to ubound($img)-1
_GDIPlus_ImageDispose($img[$x])
Next
_GDIPlus_BitmapDispose($buffer)
_GDIPlus_GraphicsDispose($backgra)
_GDIPlus_GraphicsDispose($gra)
_GDIPlus_Shutdown()
Exit
EndFunc
Func grav($pluswert,$staerke=10)
$pluswert=$pluswert+Abs($pluswert/5*1.001+2.5)/($staerke)
Return $pluswert
EndFunc
func death()
_GDIPlus_GraphicsDrawString($backgra,"Game over!",-5,50,"Arial",36)
_GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$winx,$winy)
while not _IsPressed("0D")
if WinActive($title)=0 then
WinWaitActive($title)
$skill=TimerDiff($timer)
EndIf
_WinAPI_RedrawWindow($Form1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
_GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$winx,$winy)
sleep(50)
WEnd
$xspeed=$xnorm
$skill=TimerDiff($timer)
$mx=($winx/2)-($imgx/2)
$my=($winy/2)-$imgy
$score=0
$yspeed=$ynorm
for $x=0 to (UBound($line,1)-1)/2
$y=mod($x,2)
if $y=1 then setrand($x)
if $y=0 then newrand($x)
Next
$line[0][0][0]=0
$line[0][0][1]=($winy/2)
$line[0][1][0]=$winx
$line[0][1][1]=($winy/2)
$ron=0
;~ $rocks=TimerDiff($rocket)
EndFunc
func newrand($wer)
$line[$wer][0][0]=$winx
$line[$wer][0][1]=Random($imgy,$winy-10,1)
$line[$wer][1][0]=Random(50,200,1)+$winx
$line[$wer][1][1]=$line[$wer][0][1]
$line[$wer][0][0]-=90
EndFunc
Alles anzeigen
Ich möchte gerne einen Hintergrund hinzu fügen, der heißt: background.gif. Bitte einfach einfügen so das ich beim Spiel den Hintergrund sehe.
Dazu möchte ich gerne noch wenn ich sterbe, unter Gameover so ein Neustartlink haben, weil ich muss dann sonst immer das spiel beenden.
Und wenn ich das spiel starte, geht es sofort los. Stört mich weil ich manchmal nicht so schnell bin.
Ich möchte da gerne so ein Menu wo dann erstmal Spiel starten steht, so das ich aber auch einige Menupunkte selber machen kann.
Wie gesagt, alle 3 DInge bitte einbauen, so das ich sofort das Spiel starten kann. ![]()
MfG Wusi.