Dim und Collision mit springenden Ball

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

Schranz0r

Betreff: Dim und Collision mit springenden Ball

BeitragSo, Sep 24, 2006 16:42
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich hab ein Problem mit meiner Dim Map:

Hab die so gezeichnet:
Code: [AUSKLAPPEN]
Graphics 780,600,0,2

Global Px#
Global Py#
Global An# = 1
Global Ru = 0
Global Speed# = 2.111
Global Ready = 0

timer = CreateTimer(55)

wand = LoadImage("1.png")
bg = LoadImage("2.png")
P = LoadImage("3.png")
MidHandle P
;MaskImage P,255,255,255

Restore Leveldata
Dim Level(25,19)
For y = 0 To 19
  For x = 0 To 25
   
   Read Level(x,y)
   
   Next
Next

SetBuffer BackBuffer()

Px = 270
Py = 300


Repeat
Cls

WaitTimer(timer)

If Ru = 1 Then
  Py = Py + An
ElseIf Ru = 0 Then
  Py = Py - An
EndIf

If KeyDown(205) then Px = Px + 2
If KeyDown(203) Then Px = Px - 2

   
DrawImage bg,0,0


For y = 0 To 19
  For x = 0 To 25
   
   Select Level(x,y)
   Case 1
     DrawImage wand, x*30, y*30
      DrawImage P , Px, Py
      If Ru > 1 Then Ru = 0
      If Ru = 0 Or 1  And IMAGESOVERLAP(P,Px,Py,wand,x*30,y*30) Then
         Ru = Ru +1
      EndIf
   End Select
 
   Next
Next

   Text 35,10,"RU : " + Ru

If Ready = 0 Then Color 0,0,0 : Text 390,300,"READY!!!!",1,1 : Flip : WaitKey : Ready = 1
Flip

Until KeyHit(1)

End


.Leveldata
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Data 1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1
Data 1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1


Der Ball der springt, und wenn er genau zwischen 2 tiles fällt(boden), fällt er durch.
Sonnst gehts, und prallt ab.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!HAUPTSACH et kost VIEL!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • Zuletzt bearbeitet von Schranz0r am So, Sep 24, 2006 17:52, insgesamt einmal bearbeitet

Jan_

Ehemaliger Admin

BeitragSo, Sep 24, 2006 17:51
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]
For y = 0 To 19
   For x = 0 To 25

      Select Level(x,y)
      Case 1
         DrawImage wand, x*30, y*30
         If ImagesCollide(P,Px,Py,0,wand,x*30,y*30,0) Then
            If py < y*30+30+7 And py > y*30-7 Then
               Ballyspeed=-ballyspeed
            EndIf
            If px < x*30+30+7 And px > x*30-7 Then
               Ballxspeed=-ballxspeed
            EndIf
         EndIf
      End Select
      DrawImage P , Px, Py
   Next
Next
between angels and insects

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group