Preformance
Übersicht

![]() |
ozzi789Betreff: Preformance |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi
Nicht das ihr denkte ich will euch einen script geben ihr dürft ihn verbessern ich hab echt keinen durchblick mehr (goto , schlechte strukturirung u.s.w) wäre trotzdem sehr schön wen ihr mir auf die Sprünge helfen könntet. hier der script : Code: [AUSKLAPPEN] .graph2 Graphics 800,600,16,2 AppTitle "ShootIt 1.2","Are you sure" Goto swsw .graph Cls Graphics 800,600,16,1 AppTitle "ShootIt 1.2","Are you sure" Goto swsw .swsw Cls Global x Global y Global point=0 Global plga=0 Global live=2 HidePointer SetBuffer BackBuffer() Global level=1 Global menu_timer = CreateTimer(60) fntArial=LoadFont("Arial",25) fntAriall=LoadFont("Arial",16) counter=3 water=LoadImage ("c:\Graphics\header.bmp") zeiger=LoadImage("c:\Graphics\zeig2.bmp") Button=LoadImage("c:\Graphics\1.bmp") Text1=LoadImage ("c:\Graphics\bback.jpg") gun=LoadImage ("c:\Graphics\gun.bmp") boom=LoadImage ("c:\Graphics\boom.bmp") sndseite =LoadSound ("c:\Sounds\boom.wav") boom2 =LoadSound ("c:\Sounds\boom2.wav") boom3 =LoadSound ("c:\Sounds\deactivate.wav") MaskImage Button ,255,0,255 MaskImage zeiger ,255,0,255 MaskImage water ,255,0,255 MaskImage gun ,255,0,255 SetFont fntAriall Cls .ee MoveMouse 400,300 Repeat WaitTimer (menu_timer) Cls kh=KeyHit(28) Text 360,240, "Play" Text 360,280, "Options" Text 360,320, "End" If KeyHit("200") And counter < 3 Then counter = counter+1 If KeyHit("208") And counter > 1 Then counter = counter-1 If counter = 1 And kh Then Endgame If counter = 3 And kh Then Goto game If counter = 2 And kh Then Goto option Select counter Case 3 Text 340,240, ">" Case 2 Text 340,280, ">" Case 1 Text 340,320, ">" End Select Flip 0 Forever .option Cls Repeat WaitTimer (menu_timer) kh=KeyHit(28) Text 360,240, "Windowd" Text 360,280, "Fullscreen" Text 360,320, "Back" If KeyHit("200") And counter < 3 Then counter = counter+1 If KeyHit("208") And counter > 1 Then counter = counter-1 If counter = 2 And kh Then Goto graph End If If counter = 3 And kh Then Goto graph2 End If If counter = 1 And kh Then Goto ee End If Select counter Case 3 Text 340,240, ">" Case 2 Text 340,280, ">" Case 1 Text 340,320, ">" End Select Flip Forever .game time=MilliSecs() getready plga=0 point=0 WaitTimer (menu_timer) While Not KeyHit(1) WaitTimer (menu_timer) pos = pos +1 If MouseX() >= x And MouseX() <= x + ImageWidth(Button) And MouseY() >= y And MouseY() <= y + ImageHeight(Button) And MouseDown(1) Then point= point+1 PlaySound sndseite Delay(220) EndIf If point >playerpoint Then ziel If level =1 Then playerpoint = 3 If level =2 Then playerpoint = 6 If level =3 Then playerpoint = 9 If level =4 Then playerpoint = 12 If level =5 Then playerpoint = 15 If level =6 Then playerpoint = 18 If level =7 Then super If live <1 Then End calc If pos > 800 Then pos =0 If plga=1 Goto game If MilliSecs() > tmrSparks + 800 Then tmrSparks=MilliSecs() frmSparks=( frmSparks + 1 ) Mod 3 x= Rnd (0,800) y= Rnd (0,460) End If Cls Color 255,255,255 DrawImage text1,0,0 DrawImage gun,MouseX(),400 DrawImage water,0,493 DrawImage Button,x,y DrawImage zeiger,MouseX()-22.5,MouseY()-22.2 If MouseHit(1) DrawImage boom,MouseX(),380 PlaySound boom2 End If Locate 0,495 SetFont fntArial Print "Time Left: "+time4 Locate 0,0 Print "Level: "+level Locate 0,20 Print "Lives: "+live Locate 0,570 Print "Points : "+point SetFont fntAriall Locate pos,535 Print "Shoot the Alien Ship more than "+playerpoint+" times in 20 Seconds To Kill it" Flip Wend End Function gameover() Cls Locate 340,240 Print "You lost a live" Delay(4000) Flip live=live-1 plga=plga+1 End Function Function getready() Cls:Flip Color 255,255,255 Locate 340,220 Print" GET READY" game = game+1 Delay(300) Locate 340,240 Print" 1" Delay(700) Locate 340,260 Print" 2" Delay(700) Locate 340,280 Print" 3" Delay(700) End Function Function ziel () Cls While Not KeyHit (1) Button=LoadImage("c:\Graphics\2.bmp") Text1=LoadImage ("c:\Graphics\bback.jpg") water=LoadImage ("c:\Graphics\header.bmp") MaskImage Button, 255,0,255 boom3 =LoadSound ("c:\Sounds\deactivate.wav") x2=x2+10 y2=y2+10 If x2>500 Goto qqq DrawImage Text1,0,0 DrawImage Button,x2,y2 DrawImage water,0,493 PlaySound boom3 Flip Wend Color 255,255,255 fntArial=LoadFont("Arial",25) fntAriall=LoadFont("Arial",16) SetFont fntAriall .qqq Locate 360,280 Print "!!! You made it to the next Level !!!" Locate 360,300 Print " Press Enter" Repeat Until KeyHit(28) level=level+1 plga=plga+1 End Function Function super () Cls Locate 200,200 Print "!!! You Saved the World !!!" Delay (5000) Cls endgame End Function Function Endgame() Cls Color 255,255,255 fntAriall=LoadFont("Arial",16) SetFont fntAriall Cls Locate 220,280 Print " Thanks for playing Shoot It" Locate 220,300 Print "If you wish to contact me : zgheb_96@hotmail.com" Delay ( 3000 ) Cls End End Function Function calc () time2= MilliSecs()-time time3= time2/1000 time4= 20-time3 If time4= 0 Then gameover End Function MFG OZ |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Poste den Code bitte nochmal lesbar:
1. Mit korrekter Einrückung (Innerhalb eines IFs oder Schleife jeweils mit einem Tabulator eingerückt) 2. In strukturierter Form. Dank goto hast du leider spaghetti Code erzeugt und optimierungen davon sind eigentlich unmöglich. Wenns zu langsam ist, empfielt es sich den Code nochmal korrekt strukturiert (nur Function und GoSub, kein Goto) zu schreiben, sorry |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
![]() |
The_Nici |
![]() Antworten mit Zitat ![]() |
---|---|---|
Wenn du keinen Durchblick mehr hast, haben wir erst recht keinen.
Ist wie: Zitat: Räum mein Zimmer auf. KA wo das Zeugs hingehört, aber vll. wisst ihr es ja. Und zu Goto: Selber schuld. |
||
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ok.... Habe eben so meine kleinen probleme mit functionen .. mit goto klappts besser bei mir.
Das komische nur beim Fullscreen mode happerts sonst ned . (braucht 10 -14 % cpu) |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
'Und was wären deine kleinen Probleme mit den Funktionen? Wie wäre es mit diese Probleme aus dem Weg räumen, etwas lernen und in Zukunft strukturierter und effizienter arbeiten können ? | ||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
![]() |
The_Nici |
![]() Antworten mit Zitat ![]() |
---|---|---|
z.b. für die Screenauswahl:
Code: [AUSKLAPPEN] Function setscreen(screenmode%, farbtiefe%, x%, y%) Graphics x%,y%,farbtiefe%,screenmode% End Function Dann im code z.B. so: setscreen(1,32,800,600) |
||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Und warum zum Geier sollte er einen einzigen Befehl in eine Funktion packen ? ![]() |
||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
du meinst anstatt dem goto sch**** so ne funktion machen indem man
die variablen verändert? Stellt sich der Graphics mode dann automatisch ein ? (grpahics is ja nicht mehjr ind der schleife) |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
The_Nici |
![]() Antworten mit Zitat ![]() |
---|---|---|
Graphics in einer Schleife? Gott.
@Bladerunner: Mir is auch grad aufgefallen dass ich scheisse geschrieebn hab XD |
||
![]() |
Eingeproggt |
![]() Antworten mit Zitat ![]() |
---|---|---|
Graphics in der Schleife ist sowieso nicht sehr intelligent. das macht man einmal am Anfang.
Und was Funktionen betrifft, so halte ich das für ein besseres Beispiel: Zitat: Function pythagoras(x,y)
Return Sqrt(x*x+y*y) End Function oder was dich vlt auch interessiert: Code: [AUSKLAPPEN] Function anzeige()
Text 10,10,"Hallo" Text 10,20,"Das ist ein cooler Text," Text 10,30,"der ganz einfach per Function" Text 10,50,"eingeblendet wird!" End Function |
||
Gewinner des BCC 18, 33 und 65 sowie MiniBCC 9 |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
![]() also mit nem zustand und ner if ? |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
Willi die Rübe |
![]() Antworten mit Zitat ![]() |
---|---|---|
So einen "SetScreen Befehl" ist nicht so ganz sinnfrei. Wenn man Ingame die Auflösung ändern will, müssen nämlich alle Ressourcen neu geladen werden und wieder da positioniert werden, wo sie vorher waren. Das könnte man dann alles schön in die Funktion packen.
Hier mal eine einfach Erklärung einer Funktion: Code: [AUSKLAPPEN] graphics 640,480,32,2 setbuffer backbuffer() repeat cls text 0,0, addition(5,4) ; Hier sollte 9 rauskommen flip until keyhit(1)=1 end function addition#(a#,b#) ; % nach dem Funktionsnamen, wenn Ganzzahlen mit Return zurückgegeben werden, # für Kommazahlen, $ für Strings. a# und b# sind sog. Parameter, d.h. beliebige Werte die außerhalb der Funktion definiert aber innerhalb der Funktion gebraucht werden local summe# ;Variabel als Lokal definieren, dabei Achtung: eine Variable in einer Funktion wird automatisch immer mit 0 initialisiert, auch wenn die Funktion vorher schonmal aufgerufen wurde summe#= a# + b# ; Parametern werden addiert return summe# ; Die Variable summe wird zurückgegeben. man bekommt dan den Wert mit z.B. ergebniss#=addition(5.4,5.6) end funtion |
||
Ich habe keine Lösung, aber ich bewundere das Problem.
Tehadon Q6600, MSI Neo2-FR, 4GB Ram, nVidia 7800 GTX At the Farewell Party visit: MySpace | Homepage |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Wäre es nicht eine möglichkeit das sich das Game beendet und davor noch ne andere exe öffnte ( genau das gleich einfach im fullscreenmode) ?
![]() |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
nein, denn Execfile pausiert das Programm. | ||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
![]() |
mabox |
![]() Antworten mit Zitat ![]() |
---|---|---|
Mir gings früher auch so...........Goto, keine Funktionen weil ichs nicht geblickt hab (jetzt manchmal immer noch nicht) und Spagetticode. Irgendwann hab ich, nach vielen Aufforderungen mal angefangen mir die Funktionen und den Programmaufbau richtig anzuschauen. Jetzt gehts mir viel besser und auch im Forum wird mir schneller geholfen weil man meistes im Code mehr durchblickt.
mfg Maurits |
||
Fujitsu-Siemens Laptop, 2Ghz Intel Core2Duo Prozessor, 2GB Ram, 120GB Festplatte, ATI Mobility Radeon X1400, Windows Vista Ultimate
www.mausoft.de.tl Dönerfresser Homepage |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group