Hab einige Probleme z.B. Schussintervall, Tilemap
Übersicht

![]() |
JulzBetreff: Hab einige Probleme z.B. Schussintervall, Tilemap |
![]() Antworten mit Zitat ![]() |
---|---|---|
http://julz666.piranho.de
Laded euch ma die files von meinem game und schaut es euch mal an... 1.Ich versteh nicht warum meine tilemap nicht funktioniert 2.Wie kann ich denn en kurzen stopp einlegen nach dem mein hero ca 10 schuss abgefeuert hat, so ne art nachladezeit oder so Wäre sehr dankbar wenn mir einer helfen könnte ![]() |
||
furbolg |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Zum zweiten:
Bau nen Ammo Counter rein, bei jedem Schuss machst dann Ammo = Ammo - 1, if Ammo <= 0 then ... reload .... |
||
![]() |
Julz |
![]() Antworten mit Zitat ![]() |
---|---|---|
@Alu thx das kommt davon wenn man variablen im nachhinein unbenennt ![]() @furbolg, meinst du das so wie ich das beim laufen gemacht hab ??? wenn ja, dass hab ich schon versucht wusste aber nicht genau an welche stelle ich das setzten sollte hatte es hier: Code: [AUSKLAPPEN] for l = 0 to 20 if obenschuss(l,0) = 1 then drawimage boom, obenschuss(l,1), obenschuss(l,2) obenschuss(l,2) = obenschuss(l,2) - 10 endif next |
||
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] If KeyDown(57) And z = 4 And (Not KeyDown(oben)) And (Not KeyDown(links)) And (Not KeyDown(unten)) And (Not KeyDown(rechts)) Then
If MilliSecs() - AlteZeit > 100 Then <<<< neu AlteZeit = MilliSecs() < neu shoot = shoot + 1 If shoot = 20 Then shoot = 0 rechtsschuss(shoot,0) = 1 rechtsschuss(shoot,1) = x + 25 rechtsschuss(shoot,2) = y + 10 If frame > 70 Then frame = 70 If frame < 70 Then frame = 70 counter = counter - 1 If counter = 0 Then counter = 8 frame = frame + 1 EndIf EndIf<<<neu EndIf End Function eine Möglichkeit das zu bremsen wäre mit millisecs() so wie ich es eingebaut habe noch besser wäre es wenn diese abfrage aber die ganze Function abdeckt dann brauch die nur einmal eingetippt werden nah dem Moto erst wenn 100 mllisekunden um sind dann Tasten abfragen und evt. schiesen, spart viel rechenzeit, hab ich jetzt nicht berücksichtigt Global AlteZeit <<<natürlich versuch das mal oder mach keyhit anstatt keydown Mann, ich krieg hier ne Kriese Batterien leer an tastatur |
||
[BB2D | BB3D | BB+]
|
![]() |
Julz |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ja mit keyhit werden die schuss-intervalle zu kurz danke für die antwort, das beantwortet meine frage ![]() |
||
![]() |
Julz |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich hab ne weitere frage ich hatte vorher die schüsse in 4 variablen gespeichert wegen vier richtungen jetzt will ich die aber wegen kollisionen in einer variablen speichern wie geht das ????
Hier mein code (ist en bisschen lang, die bilder könnt ihr euch wieder laden von meinem ersten text): Code: [AUSKLAPPEN] Graphics 640, 480, 16 SetBuffer BackBuffer() Global player = LoadAnimImage("Hero1.bmp",32,32,0,72) Global map = LoadanimImage("blocks.bmp",32,32,0,2) global boom = loadimage("schuss.bmp") global enemy = loadimage("enemy.bmp") MaskImage player, 66, 120, 0 Global x = 200 Global y = 200 Global z = 0 Global oben = 200 Global unten = 208 Global links = 203 Global rechts = 205 Global space = 57 Global frame = 1 Global xmap = 0 Global ymap = 0 Global counter = 2 Global Bewegung global shoot = 0 global monsterzahl = 0 Dim level(20,10) dim monster(6,2) dim schuss(3,20,2) data 0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,0,1,1 data 0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,1,1 data 0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1 data 0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0 data 0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0 data 0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,0 data 0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,0 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 for xmap = 0 to 19 for ymap = 0 to 9 read level(xmap,ymap) next next Repeat Cls drawlevel() moveplayer() drawplayer() randtest() schiessen() schussmalen() gegner() collision() Flip Until KeyHit(1) End function collision() end function function gegner() end function Function drawlevel() for xmap = 0 to 19 for ymap = 0 to 9 drawimage map,xmap*32,ymap*32,level(xmap,ymap) next next End Function Function moveplayer() If KeyDown(oben) and (not keydown(rechts)) and (not keydown(links)) and (not keydown(unten)) Then If frame > 14 Then frame = 0 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 y = y - 3 z = 1 EndIf EndIf If KeyDown(links) and (not keydown(rechts)) and (not keydown(oben)) and (not keydown(unten)) Then If frame > 30 Then frame = 16 If frame < 16 Then frame = 16 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 x = x - 3 z = 2 EndIf EndIf If KeyDown(unten) and (not keydown(rechts)) and (not keydown(links)) and (not keydown(oben)) Then If frame > 46 Then frame = 32 If frame < 32 Then frame = 32 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 y = y + 3 z = 3 EndIf EndIf If KeyDown(rechts) and (not keydown(oben)) and (not keydown(links)) and (not keydown(unten)) Then If frame > 62 Then frame = 48 If frame < 48 Then frame = 48 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 x = x + 3 z = 4 EndIf EndIf End Function Function drawplayer() DrawImage player, x, y, frame End Function Function randtest() If x < 0 Then x = 0 If x > 610 Then x = 610 If y < 0 Then y = 0 If y > 430 Then y = 430 End Function Function schiessen() If Keydown(57) And z = 1 and (not keydown(oben)) and (not keydown(links)) and (not keydown(unten)) and (not keydown(rechts)) Then shoot = shoot + 1 if shoot = 20 then shoot = 0 schuss(0,shoot,0) = 1 schuss(0,shoot,1) = x + 20 schuss(0,shoot,2) = y If frame > 64 Then frame = 64 If frame < 64 Then frame = 64 counter = counter - 1 If counter = 0 Then counter = 8 frame = frame + 1 EndIf endif If Keydown(57) And z = 2 and (not keydown(oben)) and (not keydown(links)) and (not keydown(unten)) and (not keydown(rechts)) Then shoot = shoot + 1 if shoot = 20 then shoot = 0 schuss(1,shoot,0) = 1 schuss(1,shoot,1) = x schuss(1,shoot,2) = y + 9 If frame > 66 Then frame = 66 If frame < 66 Then frame = 66 counter = counter - 1 If counter = 0 Then counter = 8 frame = frame + 1 endif endif If Keydown(57) And z = 3 and (not keydown(oben)) and (not keydown(links)) and (not keydown(unten)) and (not keydown(rechts)) Then shoot = shoot + 1 if shoot = 20 then shoot = 0 schuss(2,shoot,0) = 1 schuss(2,shoot,1) = x + 12 schuss(2,shoot,2) = y + 22 If frame > 68 Then frame = 68 If frame < 68 Then frame = 68 counter = counter - 1 If counter = 0 Then counter = 8 frame = frame + 1 EndIf endif If Keydown(57) And z = 4 and (not keydown(oben)) and (not keydown(links)) and (not keydown(unten)) and (not keydown(rechts)) Then shoot = shoot + 1 if shoot = 80 then shoot = 0 schuss(3,shoot,0) = 1 schuss(3,shoot,1) = x + 25 schuss(3,shoot,2) = y + 10 If frame > 70 Then frame = 70 If frame < 70 Then frame = 70 counter = counter - 1 If counter = 0 Then counter = 8 frame = frame + 1 EndIf endif End Function function schussmalen() for l = 0 to 20 if schuss(0,l,0) = 1 then drawimage boom, schuss(0,l,1), schuss(0,l,2) schuss(0,l,2) = schuss(0,l,2) - 10 endif next for l = 0 to 20 if schuss(1,l,0) = 1 then drawimage boom, schuss(1,l,1), schuss(1,l,2) schuss(1,l,1) = schuss(1,l,1) - 10 endif next for l = 0 to 20 if schuss(2,l,0) = 1 then drawimage boom, schuss(2,l,1), schuss(2,l,2) schuss(2,l,2) = schuss(2,l,2) + 10 endif next for l = 0 to 20 if schuss(3,l,0) = 1 then drawimage boom, schuss(3,l,1), schuss(3,l,2) schuss(3,l,1) = schuss(3,l,1) + 10 endif next end function Wäre dankbar wenn mir einer meinen fehler zeigen könnte |
||
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
schuss(3,20,2) so kann man es nicht gut abfragen
ist ja schon 3D brauchst du so gar nicht hab mir das mal angesehen und kleine veränderungen vorgenommen weil ich noch nicht pennen kann , ist auch etwas kürzer geworden Code: [AUSKLAPPEN] Graphics 640, 480, 16
SetBuffer BackBuffer() Global frameTimer=CreateTimer(60) Global player = LoadAnimImage("Hero1.bmp",32,32,0,72) Global map = LoadAnimImage("blocks.bmp",32,32,0,2) Global boom = LoadImage("schuss.bmp") Global enemy = LoadImage("enemy.bmp") MaskImage player, 66, 120, 0 Global x = 200 Global y = 200 Global z = 1 ; nicht 0 , da sonst kein schuss fällt wenn mann sich nicht bewegt Global oben = 200 Global unten = 208 Global links = 203 Global rechts = 205 Global space = 57 Global frame = 1 Global xmap = 0 Global ymap = 0 Global counter = 2 Global Bewegung Global shoot = 0 Global monsterzahl = 0 Dim level(20,10) Dim monster(6,2) Dim schuss(100,10) ; mehr wie 61 brauchen das proggi nicht Const Aktiv = 0,Pos_x = 1, Pos_y= 2, Richtung = 3; damit es mit den Dims einfacher ist Global Test_Variable,Test_Variabledummy ; nur für testzwecke Global startZeit=MilliSecs(), Bildfregenz_1 ,Bildfregenz ;FPS() nur für testzwecke Data 0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,0,1,1 Data 0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,1,1 Data 0,0,0,0,0,0,0,0,1,1,0,1,1,1,0,1,1,0,1,1 Data 0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,0,0,0 Data 0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0 Data 0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,0 Data 0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1,1,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 For xmap = 0 To 19 For ymap = 0 To 9 Read level(xmap,ymap) Next Next Repeat Cls drawlevel() moveplayer() drawplayer() randtest() schiessen() schussmalen() gegner() collision() fps() ;bremse WaitTimer(frameTimer) Flip Until KeyHit(1) End Function collision() End Function Function gegner() End Function Function drawlevel() For xmap = 0 To 19 For ymap = 0 To 9 DrawImage map,xmap*32,ymap*32,level(xmap,ymap) Next Next End Function Function moveplayer() If KeyDown(oben) And (Not KeyDown(rechts)) And (Not KeyDown(links)) And (Not KeyDown(unten)) Then If frame > 14 Then frame = 0 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 y = y - 3 z = 1 EndIf EndIf If KeyDown(links) And (Not KeyDown(rechts)) And (Not KeyDown(oben)) And (Not KeyDown(unten)) Then If frame > 30 Then frame = 16 If frame < 16 Then frame = 16 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 x = x - 3 z = 2 EndIf EndIf If KeyDown(unten) And (Not KeyDown(rechts)) And (Not KeyDown(links)) And (Not KeyDown(oben)) Then If frame > 46 Then frame = 32 If frame < 32 Then frame = 32 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 y = y + 3 z = 3 EndIf EndIf If KeyDown(rechts) And (Not KeyDown(oben)) And (Not KeyDown(links)) And (Not KeyDown(unten)) Then If frame > 62 Then frame = 48 If frame < 48 Then frame = 48 counter = counter - 1 If counter = 0 Then counter = 2 frame = frame + 1 x = x + 3 z = 4 EndIf EndIf End Function Function drawplayer() DrawImage player, x, y, frame End Function Function randtest() If x < 0 Then x = 0 If x > 610 Then x = 610 If y < 0 Then y = 0 If y > 430 Then y = 430 End Function Function schiessen() If KeyDown(57) And (Not KeyDown(oben)) And (Not KeyDown(links)) And (Not KeyDown(unten)) And (Not KeyDown(rechts)) Then For shoot= 0 To 100 If schuss(shoot, Aktiv) = 0 ; freien Schuss gefunden ;bzw Leere variable schuss(shoot, Aktiv) =1; schuss aktivieren Select z Case 1 schuss(shoot,Pos_x)= x + 20 schuss(shoot,Pos_y)= y schuss(shoot,Richtung) = z; oder 1 für Richtung, steht da ja schon frame = 64 ; ist das gleiche wie ;If frame > 64 Then frame = 64 ;If frame < 64 Then frame = 64 Case 2 schuss(shoot,Pos_x)= x schuss(shoot,Pos_y)= y +9 schuss(shoot,Richtung) = z frame = 66 Case 3 schuss(shoot,Pos_x)= x +12 schuss(shoot,Pos_y)= y +22 schuss(shoot,Richtung) = z frame = 68 Case 4 schuss(shoot,Pos_x)= x +25 schuss(shoot,Pos_y)= y +10 schuss(shoot,Richtung) = z frame = 70 Default RuntimeError " Fehler in schiessen" End Select Exit ;schleife verlassen da eine gefunden wurde End If Next ; für die Frame Schiessen counter = counter - 1 If counter = 0 Then counter = 8 frame = frame + 1 End If EndIf End Function Function schussmalen() Test_Variable= 0 ;zum zählen der max angezeigten Kugeln For shoot = 0 To 100 If schuss(shoot,Aktiv) = 1 Test_Variable=Test_Variable+1; um zu sehen wie viel schuss max laufen DrawImage boom, schuss(shoot,Pos_x), schuss(shoot,Pos_y) Select schuss(shoot,Richtung) ;je nachdem wo es hingeht Case 1 schuss(shoot,Pos_y) = schuss(shoot,Pos_y) - 10 ; nach oben Case 2 schuss(shoot,Pos_x) = schuss(shoot,Pos_x) - 10 ; nach links Case 3 schuss(shoot,Pos_y) = schuss(shoot,Pos_y) + 10; nach unten Case 4 schuss(shoot,Pos_x) = schuss(shoot,Pos_x) + 10 ;nach rechts End Select ; sicherheitsabfrage zum abschalten des Schusses muß auf jeden fall If schuss(shoot,Pos_x) < 0 Or schuss(shoot,Pos_x) > 640 Then ; abschalten da außerhalb schuss(shoot,Aktiv) = 0 End If If schuss(shoot,Pos_y) < 0 Or schuss(shoot,Pos_y) > 480 Then ; abschalten da außerhalb schuss(shoot,Aktiv) = 0 End If EndIf Next ;test für Schüsse Max. die angezeigt werden If Test_Variable > Test_Variabledummy Then Test_Variabledummy = Test_Variable Text 100,400, Test_Variabledummy End Function Function fps() Dauer = MilliSecs() - startZeit Bildfregenz_1 = Bildfregenz_1 + 1 Color 0,255,255 If Dauer > 990 Then Bildfregenz =Bildfregenz_1 Bildfregenz_1=0 dauer = 0 startZeit=MilliSecs() EndIf Text 10,430,Bildfregenz + " FPS " End Function Hoffe das du da so jetzt was mit anfangen kannst Kommentare hab ich auch drinn |
||
[BB2D | BB3D | BB+]
|
![]() |
Julz |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ok thx da sind en paar gute sachen drin danke für die mühe ich pick mir raus was ich brauch weil an manchen stellen nich so ganz durchsehe. ![]() Ne frage wenn ich den randtest nicht mache was passiert dann ??? fliegt der schuss dann immer weiter ??? Noch ne frage hättest du vielleicht ne idee wie ich den schuss unterbrechen könnte ??? das der so feuerstöße abgibt ??? |
||
![]() |
RallimenSieger des 30-EUR-Wettbewerbs |
![]() Antworten mit Zitat ![]() |
---|---|---|
ohne randtest fliegt der schuss immer weiter obwohl er nicht gezeichnet wird
Schussintervall guck ich noch mal |
||
[BB2D | BB3D | BB+]
|
![]() |
Julz |
![]() Antworten mit Zitat ![]() |
---|---|---|
Also ich hab ma ne neue version geuppt wieder der gleiche link, mit gegnern allerdings sind die strohdumm, da muss ich noch dran arbeiten....in sachen KI hab ich keine ahnung | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group