Problem mit Prop

Übersicht BlitzBasic Beginners-Corner

Dieses Thema ist gesperrt, du kannst keine Beiträge editieren oder beantworten.

ozzi789

Betreff: Problem mit Prop

BeitragMo, Nov 05, 2007 21:16
Antworten mit Zitat
Benutzer-Profile anzeigen
Hab mein Contest Game schon beinahefertig Very Happy

Doch hab so meine Probleme mit den props (die nachher die steine darstellen sollen, siehe
http://www.supergames.ch/grati...game/1724) )

Da kommt : Image out of frame ..

Komm nicht mehr weiter Embarassed


Der Code :

(Kleptomanen bitte nicht weiter lesen Very Happy )

Code: [AUSKLAPPEN]



Graphics 800,600,16,2

Global live=3
Global y= 200
Global x= 150
Global playerDx#
Global playerDy#
Global gates
Global playerGfx




background= LoadImage("c:\Graphics\background.png")
DrawImage background,0,0

zeit=MilliSecs()


rechts = KeyDown(205)
rauf   = KeyDown (200)

himmel=LoadImage ("c:\Graphics\himmel.png")
heli=LoadImage ("c:\Graphics\spako.png")
steinlein =LoadImage ("c:\Graphics\stein.png")
boom =LoadSound ("c:\Sounds\boom.wav")
WaitKey
Cls


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



Type PROP
   Field f_x#,f_y#,f_gfx,f_dX#
End Type
Function PROP_create(p_x,p_y,p_gfx,p_dX#)
   prop.PROP  = New PROP
   prop\f_x   = p_x
   prop\f_y   = p_y
   prop\f_gfx = p_gfx
   prop\f_dX  = p_dX
End Function


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



While Not KeyHit(1)
Cls
Punkte=(MilliSecs()-zeit)/20


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


   playerX   = 320
   playerDy  = 1.0
   lives     = 6
   level       = 1


For prop.PROP = Each PROP
            prop\f_x = prop\f_x + prop\f_dX
            If ((Abs(y-prop\f_y)<4) And (Abs((x+8)-(prop\f_x+ImageWidth(prop\f_gfx)/2))<ImageWidth(prop\f_gfx)*0.3)) Then
               If (ImagesCollide(heli,x,y,1+playerDx,prop\f_gfx,prop\f_x,prop\f_y,0)) Then
                  If (prop\f_gfx = steinlein) Then
                     lives = lives - 1
                     PlaySound(boom)
                  End If
                  Delete(prop)
               End If
            End If
         Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

y=y+2

Color 40,40,40
Rect 000,590,800,600

Color 255,0,0
If live = 0 Then
Cls
name$ = Input ("Gib deinen Namen ein")

OpenFile ("c:\Highscore.txt")

readout = ReadFile("c:\Highscore.txt")
punktealt = ReadLine( readout )
CloseFile (readout)

If punktealt< Punkte Then
fileout = WriteFile("c:\Highscore.txt")
WriteLine( fileout,  Punkte )
WriteLine( fileout, name$ )
CloseFile (fileout)
Cls
Print "Du hast einen neuen Highscore erstellt"
WaitKey
End
EndIf
EndIf

If punktealt> Punkte Then
Print"Du hast den Highscore nicht geschlagen"
WaitKey
End 
EndIf

If KeyDown(200) y=y-4

If x<0 Then x=1

If y>560 Then
PlaySound boom
gameover
EndIf

If y<0 Then y=y+2

DrawImage himmel ,0,0

Hier kommt : Image out of frame

=>>>   DrawImage (heli,x,y,1+playerDx)
      For prop.PROP = Each PROP
         DrawImage(prop\f_gfx,prop\f_x,prop\f_y)
      Next



Locate 0,0
Print time
Print Punkte
Print "Lives : "+live


Flip 120
Wend
End

Function gameover () ; zu ergänzen
live=live-1
y = 200
x = 150
End Function 


Danke viel mals für eure Hilfe Very Happy


[/url]
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5
 

Dreamora

BeitragMo, Nov 05, 2007 21:18
Antworten mit Zitat
Benutzer-Profile anzeigen
kann ja auch nix anderes kommen. Dein Heli hat genau 1 frame, nämlich frame 0
und du versuchst frame 1 + irgendwas zu zeichnen, das existiert nicht.
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen.

ozzi789

BeitragMo, Nov 05, 2007 21:24
Antworten mit Zitat
Benutzer-Profile anzeigen
Ach deswegen hab immer noch das unanimierte bild drinne Rolling Eyes

Danke wär echt nicht draufgekommen Very Happy

Wie findet ihr den Code bis jetz ?
(bin der einzige der den Code schon jetz zeigt Smile )
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5

ozzi789

BeitragMo, Nov 05, 2007 21:41
Antworten mit Zitat
Benutzer-Profile anzeigen
ehmm ich weiss das ist schwierg ist für euch und is nicht lustig aber ich cheks echt nicht mehr .... könnte hilfe brauchen Embarassed


Code: [AUSKLAPPEN]

Graphics 800,600,16,2

Global live=3
Global y= 200
Global x= 150
Global playerDx#
Global playerDy#
Global gates
Global playerGfx
Global level



background= LoadImage("c:\Graphics\background.png")
DrawImage background,0,0

zeit=MilliSecs()


rechts = KeyDown(205)
rauf   = KeyDown (200)

himmel=LoadImage ("c:\Graphics\himmel.png")
heli=LoadAnimImage("c:\Graphics\lord.png",34,36,0,3)
steinlein =LoadImage ("c:\Graphics\stein.png")
boom =LoadSound ("c:\Sounds\boom.wav")
WaitKey
Cls
FreeImage background


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Type PROP
   Field f_x#,f_y#,f_,f_dX#
End Type
Function PROP_create(p_x,p_y,p_gfx,p_dX#)
   prop.PROP  = New PROP
   prop\f_x   = p_x
   prop\f_y   = p_y
   prop\f_gfx = p_gfx
   prop\f_dX  = p_dX
End Function


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



While Not KeyHit(1)


Cls
Punkte=(MilliSecs()-zeit)/20


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


   playerX   = 320
   playerDy  = 1.0
   lives     = 6
   level       = 1


For prop.PROP = Each PROP
            prop\f_x = prop\f_x + prop\f_dX
            If ((Abs(y-prop\f_y)<4) And (Abs((x+8)-(prop\f_x+ImageWidth(prop\f_gfx)/2))<ImageWidth(prop\f_gfx)*0.3)) Then
               If (ImagesCollide(heli,x,y,1+playerDx,prop\f_gfx,prop\f_x,prop\f_y,0)) Then
                  If (prop\f_gfx = steinlein) Then
                     lives = lives - 1
                     PlaySound(boom)
                  End If
                  Delete(prop)
               End If
            End If
         Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;




         
         If (KeyDown(203)) Then
            playerDx = -1
         Else If (KeyDown(205)) Then
            playerDx = 1
         End If
         playerX = playerX + playerDx*1.0
         For prop.PROP = Each PROP
            prop\f_y = prop\f_y - playerDy
            If (prop\f_y < -24) Then
               Delete(prop)
            Else If ((prop\f_gfx=steinlein) And (prop\f_y<(playerY-24))) Then
               lives = lives - 1
               Delete(prop)
               PlaySound(snd_invalid)
            End If
         Next


y=y+2

Color 40,40,40
Rect 000,590,800,600

Color 255,0,0
If live = 0 Then
Cls
name$ = Input ("Gib deinen Namen ein")

OpenFile ("c:\Highscore.txt")

readout = ReadFile("c:\Highscore.txt")
punktealt = ReadLine( readout )
CloseFile (readout)

If punktealt< Punkte Then
fileout = WriteFile("c:\Highscore.txt")
WriteLine( fileout,  Punkte )
WriteLine( fileout, name$ )
CloseFile (fileout)
Cls
Print "Du hast einen neuen Highscore erstellt"
WaitKey
End
EndIf
EndIf

If punktealt> Punkte Then
Print"Du hast den Highscore nicht geschlagen"
WaitKey
End 
EndIf

If KeyDown(200) y=y-4

If x<0 Then x=1

If y>560 Then
PlaySound boom
gameover
EndIf


      gateTimer = gateTimer + 1

If (gateTimer > 250) Then
            PROP_create(640/2+Rand(-150,150),480,steinlein,0)
            gateTimer = 0
         End If
         If ((Rand(100)>(100.5-level*0.5))) Then
            side = Rand(0,1)*2
            PROP_create(side/2*640,480,g_gfx_laser,(1-side)*Rnd(2.0*3.5))
         End If
         If ((MilliSecs()-startTime)>15000) Then
            level       = level + 1
            startTime = MilliSecs()         
         End If




If y<0 Then y=y+2

DrawImage himmel ,0,0


   DrawImage (heli,x,y,1+playerDx)
      For prop.PROP = Each PROP
         DrawImage(prop\f_gfx,prop\f_x,prop\f_y)
      Next



Locate 0,0
Print time
Print Punkte
Print "Lives : "+live


Flip 120
Wend
   Delete Each PROP
End

Function gameover () ; zu ergänzen ; absturtz
live=live-1
y = 200
x = 150
End Function 
[/code]
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5

BladeRunner

Moderator

BeitragMo, Nov 05, 2007 21:51
Antworten mit Zitat
Benutzer-Profile anzeigen
~GESCHLOSSEN~


Warum?
-Doppelpost
-Code ohne Fehlerbeschreibung: sinnfrei.
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

Dieses Thema ist gesperrt, du kannst keine Beiträge editieren oder beantworten.


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group