Seite 1 von 1

[Erledigt] Falsche Bilder werden angezeigt...

Verfasst: 15.11.2007 22:00
von Morpheus
Hi Leute...

Ich habe das Problem das bei mir wenn ich auf neues Spiel klicke die falschen Grafiken angezeigt werden... angezeigt werden sollen folgende Bilder:

Code: Alles auswählen

Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
  
  x = MouseX()
  y = 575
  
  TransparentSpriteColor(21,0,0,0)
  TransparentSpriteColor(23,0,0,0)
  DisplayTransparentSprite(21,x,y)
  DisplaySprite(22,x+50,y)
  DisplayTransparentSprite(23,x+100,y)
  
  TransparentSpriteColor(20,255,255,255)
  DisplayTransparentSprite(20,a,b)
  ...
die bei:

Code: Alles auswählen

OpenPack("data\tex\game.mtp")
  CatchSprite(20,NextPackFile())                      ;ba.bmp
  CatchSprite(21,NextPackFile())                      ;bl.bmp
  CatchSprite(22,NextPackFile())                      ;bm.bmp
  CatchSprite(23,NextPackFile())                      ;br.bmp
ClosePack()
geladen werden...

anzeigen tut er aber diese Bilder:

Code: Alles auswählen

Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
  
  DisplaySprite(0,0,e)
  DisplaySprite(1,f,400)
  DisplaySprite(2,g,400)
  ...
die bei...

Code: Alles auswählen

OpenPack("data\tex\intro.mtp")
  CatchSprite(0,NextPackFile())                       ;micro.bmp
  CatchSprite(1,NextPackFile())                       ;ndesign.bmp
  CatchSprite(2,NextPackFile())                       ;spacecom.bmp
  CatchSprite(3,NextPackFile(),#PB_Sprite_Memory)     ;micro2.bmp
ClosePack()
geladen werden.

Ich möchte dazu sagen das die Bilder die er anzeigen soll sich in einer anderen Repeat-Schleife befinden...

Desweiteren folgender Hinweis: Im QUellcode funzt alles... aber sobald ich eine *.exe erstellt habe und diese Starte läuft alles bis zum Hauptmenü auch wunderbar... erst wenn ich dann in die besagte schleife wechsle geht es nicht mehr und er zeigt die falschen bilder (die ja auch viel zu groß sind)

Ich hoffe ihr könnt mir helfen... für weitere Fragen stehe ich zur verfügung...

MfG
Morpheus

Verfasst: 15.11.2007 23:59
von ZeHa
Ich glaub Du müßtest den zusammenhängenden Code posten. Diese Bruchstücke können ja "sauber" sein, aber es kann z.B. die Reihenfolge schuld dran sein, daß irgendwas schiefläuft...

Verfasst: 16.11.2007 01:27
von Morpheus
OK... dann hier der Komplette Code... ist aber ein wenig lang...

Code: Alles auswählen

If InitSprite() = 0
EndIf

If InitKeyboard() = 0
EndIf

If InitMouse() = 0
EndIf

If InitSound() = 0
EndIf

SetRefreshRate(60)

If OpenScreen(800,600,16,"DB") = 0
EndIf

SetFrameRate(60)

;--------------Loading----------------;

OpenPack("data\tex\intro.mtp")
  CatchSprite(0,NextPackFile())                       ;micro.bmp
  CatchSprite(1,NextPackFile())                       ;ndesign.bmp
  CatchSprite(2,NextPackFile())                       ;spacecom.bmp
  CatchSprite(3,NextPackFile(),#PB_Sprite_Memory)     ;micro2.bmp
ClosePack()

OpenPack("data\tex\menu.mtp")
  CatchSprite(4,NextPackFile(),#PB_Sprite_Memory)     ;menu1.bmp
  CatchSprite(5,NextPackFile())                       ;ng1.bmp
  CatchSprite(6,NextPackFile())                       ;ng2.bmp
  CatchSprite(7,NextPackFile())                       ;cursor1.bmp
  CatchSprite(8,NextPackFile())                       ;cursor2.bmp
  CatchSprite(9,NextPackFile())                       ;o1.bmp
  CatchSprite(10,NextPackFile())                      ;o2.bmp
  CatchSprite(11,NextPackFile())                      ;c1.bmp
  CatchSprite(12,NextPackFile())                      ;c2.bmp
  CatchSprite(13,NextPackFile())                      ;e1.bmp
  CatchSprite(14,NextPackFile())                      ;e2.bmp
ClosePack()

OpenPack("data\tex\game.mtp")
  CatchSprite(15,NextPackFile())                      ;ba.bmp
  CatchSprite(16,NextPackFile())                      ;bl.bmp
  CatchSprite(17,NextPackFile())                      ;bm.bmp
  CatchSprite(18,NextPackFile())                      ;br.bmp
ClosePack()

;--------------Loading Ende-----------;

;-----------------Intro---------------;

e = -600
f = -200
g = 800
Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
  
  DisplaySprite(0,0,e)
  DisplaySprite(1,f,400)
  DisplaySprite(2,g,400)
  
  e + 2
  
  If e > 0
    e-2
    f+2
    g-2
  EndIf
  
  If f > 150
    f-2
  EndIf
  
  If g < 450
    g+2
  EndIf
  
  If KeyboardPushed(#PB_Key_escape)
    Gosub main
  EndIf
  
  If e = 0
    If f = 150
      If g = 450
        Gosub change
      EndIf
    EndIf
  EndIf
ForEver

change:
z=255
Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
  
  DisplayTranslucideSprite(3,0,0,z)
  
  z - 5
  
  If KeyboardPushed(#PB_Key_escape)
    End
  EndIf
  
  If z = 0
    Gosub main
  EndIf
ForEver

;---------------------Intro Ende---------------------;

;----------------------Hauptmenü---------------------;

main:
z=0
Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
  
  StartSpecialFX()
  DisplayTranslucideSprite(4,0,0,z)
  StopSpecialFX()
  
  DisplaySprite(5,295,190)
  DisplaySprite(9,295,250)
  DisplaySprite(11,295,310)
  DisplaySprite(13,295,370)
  
  If SpriteCollision(5,295,190,7,x,y)
    DisplaySprite(6,295,190)
    If MouseButton(1)
      Gosub test
    EndIf
  EndIf
  
  If SpriteCollision(9,295,250,7,x,y)
    DisplaySprite(10,295,250)
  EndIf
  
  If SpriteCollision(11,295,310,7,x,y)
    DisplaySprite(12,295,310)
  EndIf
  
  If SpriteCollision(13,295,370,7,x,y)
    DisplaySprite(14,295,370)
    If MouseButton(1)
      End
    EndIf
  EndIf
  
  StartDrawing(ScreenOutput())
  DrawingMode(1)
  FrontColor(150,150,150)
  Locate(10,580)
  DrawText("Version: 0.1b")
  StopDrawing()
  
  x = MouseX()
  y = MouseY()
  
  DisplaySprite(7,x,y)
  TransparentSpriteColor(8,255,255,255)
  DisplayTransparentSprite(8,x,y)
  
  z + 5
  
  If z > 255
    z-5
  EndIf
  
  If KeyboardPushed(#PB_Key_escape)
    End
  EndIf
ForEver

;-------------------------Hauptmenü Ende------------------;

;--------------------------Testprogramm-------------------;

test:
a=335
b=544
s=0
c=5
d=5
x=0
y=0
z=0
Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
  
  x = MouseX()
  y = 575
  
  TransparentSpriteColor(16,0,0,0)
  TransparentSpriteColor(18,0,0,0)
  DisplayTransparentSprite(16,x,y)
  DisplaySprite(17,x+50,y)
  DisplayTransparentSprite(18,x+100,y)
  
  TransparentSpriteColor(15,255,255,255)
  DisplayTransparentSprite(15,a,b)
  
  If SpritePixelCollision(16,x,y,15,a,b)
    If d=10
      d=0
    EndIf
    If d=9
      d=1
    EndIf
    If d=8
      d=2
    EndIf
    If d=7
      d=3
    EndIf
    If d=6
      d=4
    EndIf
    
    If c=0
      c-1
    EndIf
    If c=1
      c-1
    EndIf
    If c=2
      c-1
    EndIf
    If c=3
      c-1
    EndIf
    If c=4
      c-1
    EndIf
    If c=5
      c-1
    EndIf
    If c=6
      c-1
    EndIf
    If c=7
      c-1
    EndIf
    If c=8
      c-1
    EndIf
    If c=9
      c-1
    EndIf
    If c=10
      c-1
    EndIf
    If c<0
      c+1
    EndIf
    z+1
  EndIf
  
  If SpritePixelCollision(17,x+50,y,15,a,b)
    If d=10
      d=0
    EndIf
    If d=9
      d=1
    EndIf
    If d=8
      d=2
    EndIf
    If d=7
      d=3
    EndIf
    If d=6
      d=4
    EndIf
    z+1
  EndIf
  
  If SpritePixelCollision(18,x+100,y,15,a,b)
    If d=10
      d=0
    EndIf
    If d=9
      d=1
    EndIf
    If d=8
      d=2
    EndIf
    If d=7
      d=3
    EndIf
    If d=6
      d=4
    EndIf
    
    If c=10
      c+1
    EndIf
    If c=9
      c+1
    EndIf
    If c=8
      c+1
    EndIf
    If c=7
      c+1
    EndIf
    If c=6
      c+1
    EndIf
    If c=5
      c+1
    EndIf
    If c=4
      c+1
    EndIf
    If c=3
      c+1
    EndIf
    If c=2
      c+1
    EndIf
    If c=1
      c+1
    EndIf
    If c=0
      c+1
    EndIf
    If c>10
      c-1
    EndIf
    z+1
  EndIf
  
  If KeyboardPushed(#PB_Key_space)
    If s=0
      c = Random(10)
      d = 1
      s + 1
    EndIf
  EndIf
  
  If c=0
    a-5
  EndIf
  If c=1
    a-4
  EndIf
  If c=2
    a-3
  EndIf
  If c=3
    a-2
  EndIf
  If c=4
    a-1
  EndIf
  If c=5
    a+0
  EndIf
  If c=6
    a+1
  EndIf
  If c=7
    a+2
  EndIf
  If c=8
    a+3
  EndIf
  If c=9
    a+4
  EndIf
  If c=10
    a+5
  EndIf
  
  If d=0
    b-5
  EndIf
  If d=1
    b-4
  EndIf
  If d=2
    b-3
  EndIf
  If d=3
    b-2
  EndIf
  If d=4
    b-1
  EndIf
  If d=5
    b+0
  EndIf
  If d=6
    b+1
  EndIf
  If d=7
    b+2
  EndIf
  If d=8
    b+3
  EndIf
  If d=9
    b+4
  EndIf
  If d=10
    b+5
  EndIf
  
  If a <= 0
    If c=0
      c=10
    EndIf
    If c=1
      c=9
    EndIf
    If c=2
      c=8
    EndIf
    If c=3
      c=7
    EndIf
    If c=4
      c=6
    EndIf
  EndIf
  If a >= 600
    If c=10
      c=0
    EndIf
    If c=9
      c=1
    EndIf
    If c=8
      c=2
    EndIf
    If c=7
      c=3
    EndIf
    If c=6
      c=4
    EndIf
  EndIf
  If b <= 0
    If d=0
      d=10
    EndIf
    If d=1
      d=9
    EndIf
    If d=2
      d=8
    EndIf
    If d=3
      d=7
    EndIf
    If d=4
      d=6
    EndIf
  EndIf
  
  If KeyboardPushed(#PB_Key_escape)
    End
  EndIf
ForEver

;---------------------------Testprogramm Ende-----------------------;
und hier noch der Code für die Packdateien

Code: Alles auswählen

CreatePack("data\tex\intro.mtp")
  AddPackFile("data\tex\micro.bmp")
  AddPackFile("data\tex\ndesign.bmp")
  AddPackFile("data\tex\spacecom.bmp")
  AddPackFile("data\tex\micro2.bmp")
ClosePack()

CreatePack("data\tex\menu.mtp")
  AddPackFile("data\tex\menu1.bmp")
  AddPackFile("data\tex\ng1.bmp")
  AddPackFile("data\tex\ng2.bmp")
  AddPackFile("data\tex\cursor1.bmp")
  AddPackFile("data\tex\cursor2.bmp")
  AddPackFile("data\tex\o1.bmp")
  AddPackFile("data\tex\o2.bmp")
  AddPackFile("data\tex\c1.bmp")
  AddPackFile("data\tex\c2.bmp")
  AddPackFile("data\tex\e1.bmp")
  AddPackFile("data\tex\e2.bmp")
ClosePack()

CreatePack("data\tex\game.mtp")
  AddPackFile("data\tex\ba.bmp")
  AddPackFile("data\tex\bl.bmp")
  AddPackFile("data\tex\bm.bmp")
  AddPackFile("data\tex\br.bmp")
ClosePack()
Ich hoffe ihr könnt mir da weiterhelfen...

Also der Fehler tritt im Bereich des "Testprogramm" auf... die Bilder 15,16,17 und 18 werden einfach durch die Bilder 0,1,2 und 3 ersetzt.

MfG
Morpheus

Verfasst: 16.11.2007 01:41
von STARGÅTE
sry das ich mal was neben bei sage aber du kannst viele verkleinern:

zB.

Code: Alles auswählen

  If d=0 
    b-5 
  EndIf 
  If d=1 
    b-4 
  EndIf 
  If d=2 
    b-3 
  EndIf 
  If d=3 
    b-2 
  EndIf 
  If d=4 
    b-1 
  EndIf 
  If d=5 
    b+0 
  EndIf 
  If d=6 
    b+1 
  EndIf 
  If d=7 
    b+2 
  EndIf 
  If d=8 
    b+3 
  EndIf 
  If d=9 
    b+4 
  EndIf 
  If d=10 
    b+5 
  EndIf 
zu dem hier:

Code: Alles auswählen

 For i = 0 to 10
  If d=i 
   b+(i-5) 
  EndIf 
 Next i

Verfasst: 16.11.2007 01:42
von NicTheQuick
Ich hab jetzt nichts, was zur Lösung deines Problems beiträgt, aber ich
habe mal dein Testprogramm gekürzt, weil's einfach viel zu umständlich
programmiert war.

Code: Alles auswählen

;--------------------------Testprogramm-------------------;

test:
a=335
b=544
s=0
c=5
d=5
x=0
y=0
z=0
Repeat
  ExamineKeyboard()
  ExamineMouse()
  FlipBuffers()
  ClearScreen(0,0,0)
 
  x = MouseX()
  y = 575
 
  TransparentSpriteColor(16,0,0,0)
  TransparentSpriteColor(18,0,0,0)
  DisplayTransparentSprite(16,x,y)
  DisplaySprite(17,x+50,y)
  DisplayTransparentSprite(18,x+100,y)
 
  TransparentSpriteColor(15,255,255,255)
  DisplayTransparentSprite(15,a,b)
 
  If SpritePixelCollision(16,x,y,15,a,b)
    If d >= 6 And d <= 10
      d = 10 - d
    EndIf
    If c >= 0 And c <= 10
      c -1
    ElseIf c < 0
      c + 1
    EndIf
   
    z+1
  EndIf
 
  If SpritePixelCollision(17,x+50,y,15,a,b)
    If d >= 6 And d <= 10
      d = 10 - d
    EndIf
    z+1
  EndIf
 
  If SpritePixelCollision(18,x+100,y,15,a,b)
    If d >= 6 And d <= 10
      d = 10 - d
    EndIf
    
    If c >= 0 And c <= 10
      c + 1
    ElseIf c < 0
      c - 1
    EndIf
    z+1
  EndIf
 
  If KeyboardPushed(#PB_Key_Space)
    If s=0
      c = Random(10)
      d = 1
      s + 1
    EndIf
  EndIf
  
  If c >= 0 And c <= 10
    a - 5 + c
  EndIf
  
  If d >= 0 And d <= 10
    b - 5 + d
  EndIf
 
  If a <= 0
    If c >= 0 And c <= 4
      c = 10 - c
    EndIf
  EndIf
  If a >= 600
    If c >= 6 And c <= 10
      c = 10 - c
    EndIf
  EndIf
  If b <= 0
    If d >= 0 And d <= 4
      d = 10 - d
    EndIf
  EndIf
 
  If KeyboardPushed(#PB_Key_Escape)
    End
  EndIf
ForEver

;---------------------------Testprogramm Ende-----------------------; 

Verfasst: 16.11.2007 01:54
von Morpheus
Es war für mich eigentlich ganz gut zu übersehen... der Punkt ist nur das ich bei dem...

ob es nun mit for i = 0 to 10 ... ist oder die andere variante... bei meinem Model blicke ich ganz gut durch... werde aber eure Vorschläge mal intensiv durchdenken...

Was mein Problem angeht habe ich glaube ich die Lösung gefunden...

Es liegt an den Packdateien...
nach jedem ClosePack() habe ich dir gepackte datei an einem anderen Ort kopieren lassen... mit der selben Verzeichnisstruktur... nur ohne Sourcecodes... dafür war halt die *.exe da...

hier nochmal der komplette packvorgang:

Code: Alles auswählen

CreatePack("data\tex\intro.mtp")
  AddPackFile("data\tex\micro.bmp")
  AddPackFile("data\tex\ndesign.bmp")
  AddPackFile("data\tex\spacecom.bmp")
  AddPackFile("data\tex\micro2.bmp")
ClosePack()

CopyFile("data\tex\intro.mtp","C:\Dokumente und Einstellungen\IceDragon\Desktop\Demolition Ball - Exe\data\tex\intro.mtp")

CreatePack("data\tex\menu.mtp")
  AddPackFile("data\tex\menu1.bmp")
  AddPackFile("data\tex\ng1.bmp")
  AddPackFile("data\tex\ng2.bmp")
  AddPackFile("data\tex\cursor1.bmp")
  AddPackFile("data\tex\cursor2.bmp")
  AddPackFile("data\tex\o1.bmp")
  AddPackFile("data\tex\o2.bmp")
  AddPackFile("data\tex\c1.bmp")
  AddPackFile("data\tex\c2.bmp")
  AddPackFile("data\tex\e1.bmp")
  AddPackFile("data\tex\e2.bmp")
ClosePack()

CopyFile("data\tex\menu.mtp","C:\Dokumente und Einstellungen\IceDragon\Desktop\Demolition Ball - Exe\data\tex\menu.mtp")

CreatePack("data\tex\game.mtp")
  AddPackFile("data\tex\ba.bmp")
  AddPackFile("data\tex\bl.bmp")
  AddPackFile("data\tex\bm.bmp")
  AddPackFile("data\tex\br.bmp")
ClosePack()

CopyFile("data\tex\intro.mtp","C:\Dokumente und Einstellungen\IceDragon\Desktop\Demolition Ball - Exe\data\tex\game.mtp")
Aus mir unerklärlichen Gründen werden aber bei der kopie der game.mtp die selben dateien gepackt wie in der in der intro.mtp

Ich habe nehmlich mal die Dateigrößen verglichen und festgestellt das die identisch waren... habe sie dann mal mit der Original pak datei ersetzt und siehe da... es geht...

Aber warum packt er jetzt die falschen dateien... das aber auch nur bei der kopie die ja erst nach dem packen erstellt wird...

MfG
Morpheus

<edit>
Problem gerade gesehen beim lesen des post...
Ich kopiere 2 x die intro.mtp einmal nach intro und einmal nach game... oh man... wie doof kann man sein...

Danke für eure hilfe... habt mir echt geholfen...