Ruckeln beim Scrollung bei nem JumpnRun-Spiel

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

Kryan

Betreff: Ruckeln beim Scrollung bei nem JumpnRun-Spiel

BeitragDo, Jun 02, 2005 19:03
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi,
irgendwie kann ich mir das nicht erklären, dass es so ruckelt:
BlitzBasic: [AUSKLAPPEN]

Graphics 1024,768
SetBuffer BackBuffer()
playerx#=0
playery#=0
beschl#=1
speedy=60
knocky=50
live#=100
abwehr#=0
scrollx#=0
scrolly#=0
Dim Level(500,500)
Dim Items(500,500)
Dim Monster(100,13)
For x=1 To 100
For y=1 To 100
Level(x,y)=20
Next
Next
file=ReadFile(\"test.lvl\")
maxX=ReadLine(file)
maxY=ReadLine(file)
For y=1 To maxY
For x=1 To maxX
byte=ReadByte(file)-48
Level(x,y)=byte
Next
ReadByte file
ReadByte file
Next
ReadByte(file)
ReadByte(file)
enemies=ReadLine(file)
For i=1 To enemies
Monster(i,0)=1
Monster(i,1)=ReadInt(file)
Monster(i,2)=ReadInt(file)
Monster(i,3)=Monster(i,1)
Monster(i,4)=ReadInt(file)
Monster(i,5)=ReadInt(file)
Monster(i,6)=ReadInt(file)
Monster(i,7)=ReadInt(file)
Monster(i,8)=MilliSecs()
Monster(i,9)=+1
Monster(i,10)=0
Monster(i,11)=MilliSecs()
Monster(i,12)=ReadInt(file)
Next
For y=1 To maxY
For x=1 To maxX
byte=ReadByte(file)-55
Items(x,y)=byte
Next
ReadByte file
ReadByte file
Next
img=LoadAnimImage(\"pics\tiles.bmp\",34,34,0,100)
pickups=LoadAnimImage(\"pics\pickups.bmp\",34,30,0,7)
run=LoadAnimImage(\"pics\char4.bmp\",40,66,0,18)
knock=LoadAnimImage(\"pics\char5.bmp\",43,66,0,10)
jump=LoadAnimImage(\"pics\char6.bmp\",45,53,0,8)
schnecke=LoadAnimImage(\"pics\schnecke.bmp\",33,33,0,10)
krebs=LoadAnimImage(\"pics\krebs.bmp\",54,24,0,8)
frosch=LoadAnimImage(\"pics\frosch.bmp\",52,40,0,8)
muecke=LoadAnimImage(\"pics\muecke.bmp\",35,41,0,14)
schlange=LoadAnimImage(\"pics\schlange.bmp\",86,45,0,16)
mammut=LoadAnimImage(\"pics\mammut.bmp\",128,83,0,10)
fliege=LoadAnimImage(\"pics\fliege.bmp\",50,35,0,14)
Repeat
Cls
If KeyDown(57) Then
If links And kanim=0 Then kanim=5
If knocktimer<MilliSecs()-knocky Then
knocktimer=MilliSecs()
kanim=Pendel(kanim,links*5,4+links*5)
End If
Else
kanim=0
End If
If KeyHit(56) Then
If sprung=0 And fanim=0 Then sprung=1
ElseIf KeyDown(56) Then
If weite#<20 Then weite=weite+1
Else
weite=0
End If
If sprung Then
sprung=Pendel(sprung,0,6+weite)
playery=playery-8
fanim=0
ElseIf Level(playerx/30+1,playery/30+2.5)=20 Then
If links And fanim=0 Then fanim=5
If jumptimer<MilliSecs()-40 Then
For i=1 To 12
playery=playery+1
If playery-scrolly>384 Then scrolly=scrolly+1
If Level(playerx/30+1,playery/30+2.5)<>20 Then Exit
Next
jumptimer=MilliSecs()
fanim=links*4+2
End If
Else fanim=0
End If
If KeyDown(205) Then
If runtimer<MilliSecs()-speedy Then
runtimer=MilliSecs()
playerx=playerx+12+Int(beschl)
ranim=Pendel(ranim,0,3)
If beschl<5 And fanim=0 Then beschl=beschl+.6
End If
rechts=1
links=0
ElseIf KeyDown(203) And playerx>10 Then
If runtimer<MilliSecs()-speedy Then
runtimer=MilliSecs()
playerx=playerx-12-Int(beschl)
ranim=Pendel(ranim,8,12)
If beschl<5 And fanim=0 Then beschl=beschl+.6
End If
links=1
rechts=0
Else
If rechts=1 Then
ranim=7
End If
If links=1 Then
ranim=12
End If
If beschl>0 And fanim=0 Then beschl=beschl-1
End If
scrollx=playerx-512
scrolly=playery-384
For x=1 To maxx
For y=1 To maxy
Viewport x*30-30-scrollx,y*30-30-scrolly,32,32
DrawImage img,x*30-32-scrollx,y*30-32-scrolly,Level(x,y)
If Items(x,y)>0 Then
DrawImage pickups,x*30-32-scrollx,y*30-32-scrolly,Items(x,y)
If ImagesCollide(pickups,x*30-32-scrollx,y*30-32-scrolly,Items(x,y),run,playerx-scrollx,playery-scrolly,ranim) Then
Select Items(x,y)
Case 1 live=live+1
Case 2 speedy=speedy-2
Case 3 live=live+3
Case 4 live=live+15
Case 5 knocky=knocky-2
Case 6 abwehr=abwehr-.5
End Select
Items(x,y)=0
End If
End If
Next
Next
Viewport 0,0,GraphicsWidth(),GraphicsHeight()
If kanim Then
DrawImage knock,playerx-scrollx,playery-scrolly,kanim
ElseIf fanim Then
DrawImage jump,playerx-scrollx,playery-scrolly,fanim
Else
DrawImage run,playerx-scrollx,playery-scrolly,ranim
End If
livev#=0
For i=1 To enemies
If Monster(i,0) Then
maxanim=0
Select Monster(i,5)
Case 1
maxanim=3
draw=schnecke
Case 2
maxanim=2
draw=krebs
Case 3
maxanim=2
draw=frosch
Case 4
maxanim=5
draw=muecke
Case 5
maxanim=6
draw=schlange
Case 6
maxanim=3
draw=mammut
Case 7
maxanim=5
draw=fliege
End Select
bew=0
If Monster(i,8)<MilliSecs()-Monster(i,6) Then
Monster(i,8)=MilliSecs()
Monster(i,10)=Pendel(MOnster(i,10),0,maxanim)
bew=1
Monster(i,1)=Monster(i,1)+Monster(i,9)*9
If Monster(i,1)<Monster(i,3) Or Monster(i,1)>Monster(i,4) Then Monster(i,9)=-Monster(i,9)
End If
If ImagesCollide(draw,Monster(i,1)-scrollx,Monster(i,2)-scrolly,Monster(i,10),knock,playerx-scrollx,playery-scrolly,kanim) Then
If Monster(i,13)<MilliSecs()-200 Then
Monster(i,13)=MilliSecs()
livev=(livev)+(livev=0)*Floor(Monster(i,12)-abwehr)
End If
If Monster(i,11)<MilliSecs()-knocky Then
Monster(i,11)=MilliSecs()
If kanim Then
Monster(i,7)=Monster(i,7)-1
If Monster(i,7)=0 Then
Monster(i,0)=0
Select Monster(i,5)
Case 1
Items(Monster(i,1)/32+1,Monster(i,2)/32)=3
Case 3
Items(Monster(i,1)/32+1,Monster(i,2)/32)=5
Case 6
Items(Monster(i,1)/32+2,Monster(i,2)/32)=4
Items(Monster(i,1)/32+4,Monster(i,2)/32)=4
End Select
End If
Monster(i,10)=maxanim+1
End If
If bew Then Monster(i,1)=Monster(i,1)-Monster(i,9)*9
End If
End If
DebugLog Monster(i,10)+(Monster(i,9)>0)*(maxanim+2)
DrawImage draw,Monster(i,1)-scrollx,Monster(i,2)-scrolly,Monster(i,10)+(Monster(i,9)>0)*(maxanim+2)
End If
Next
If livev>0 Then live=live-livev/10
For i=1 To live
Color 255-i*1.5,i*1.5,0
Rect i*5,0,5,40
Next
Flip
Until KeyHit(1)
End

Function Pendel(x1,x3,x2,s=1)
x1=x1+s
If x1>x2 Then x1=x3
Return x1
End Function

ok, so wird wahrscheinlich niemand den fehler finden, deshalb hier auch noch der download:
http://www.gwebspace.de/kryan/pics/StoneAge.rar
Webspaceanbieter?
Klick hier!
Kultige Spieleschmiede?
Klick hier!

Chester

BeitragDo, Jun 02, 2005 19:46
Antworten mit Zitat
Benutzer-Profile anzeigen
Könntest du deinen Code mal filtern bzw. nur die ScollRoutine reinschreiben? Denn so wirst du wohl kaum jemand finden, der dir hilft.

Mfg
ChEsTeR

PS: Benutz mal Kommentare! Spätestens nach 1 Woche weißst du nicht mehr was was ist.

Rallimen

Sieger des 30-EUR-Wettbewerbs

BeitragDo, Jun 02, 2005 20:39
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich denke mal das das Problem hier liegt!
BlitzBasic: [AUSKLAPPEN]
If KeyDown(205) Then 
If runtimer<MilliSecs()-speedy Then
runtimer=MilliSecs()
playerx=playerx+12+Int(beschl)
ranim=Pendel(ranim,0,3)
If beschl<5 And fanim=0 Then beschl=beschl+.6
End If
rechts=1
links=0
ElseIf KeyDown(203) And playerx>10 Then
If runtimer<MilliSecs()-speedy Then
runtimer=MilliSecs()
playerx=playerx-12-Int(beschl)
ranim=Pendel(ranim,8,12)
If beschl<5 And fanim=0 Then beschl=beschl+.6
End If
links=1
rechts=0
Else
If rechts=1 Then
ranim=7
End If
If links=1 Then
ranim=12
End If
If beschl>0 And fanim=0 Then beschl=beschl-1
End If


da Speedy den Wert 60 hat wird deine Map nur
1000/60= 16,6 Bilder Pro sekunde versetzt! und dann mit 12 Pixeln + Beschleunigung welche auch noch bis 5 geht sind das 17 Pixel

bei der Downloadvariante steht der Wert auf 100 und das ruckelt dann noch extremer da es nur 10 Bilder Pro Sekunde sind

was du machen kannst ist folgendes den wert von 60 auf 16 setzten was eine Bildwiederholung von ca 60 sind
und die playerx+12+Int(beschl) natürlich kleiner machen! ich denke mal 1 bis 2 anstatt 12 !
[BB2D | BB3D | BB+]

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group