Player läuft ruckelig

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

 

marcelm

Betreff: Player läuft ruckelig

BeitragSa, März 28, 2009 16:19
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo,


mir ist kein besserer Titel eingefallen, sorry Wink

Also,

ich hab ne map die aus tiles aufgebaut wird.
Wenn meine Figur sich nun bewegen soll (Geschw. 1) dann ist sie viel zu schnell. Stelle ich die Geschw. auf 0.1, dann ruckelt die ganze Map beim mitscrollen, da die Tiles in 32er Schritten gezeichnet werden.

Wie kann ich es machen, dass ich nicht in 32er Schritten laufen muss, damit nicht es ruckelig ist?

Hier mein komletter Code:

Code: [AUSKLAPPEN]
Graphics 800, 600, 32, 2
SetBuffer BackBuffer()


bg = LoadAnimImage("gfx\background.bmp", 32, 32, 0, 6)
pl = LoadImage("gfx\player.bmp")
MidHandle pl

akt = 1
posx# = -12
posy# = -9

Dim map(200,200)

; LADEn

posx = -12
posy = -9
   
   karte$ = ReadFile("map1.map")
   
   For x = 0 To 100
      For y = 0 To 100
      
         akt = ReadLine(karte$)
         map(x-posx,y-posy) = ReadInt(karte$)
         
      Next
   Next
   
   CloseFile(karte$)

While Not KeyHit(1)

Cls

; karte zeichenen (incl. verschiebung)

For x=0 To 100

   For y=0 To 100

      DrawImage bg, x*32, y*32, map(x-posx, y-posy)
   
   Next

Next

; map editor

DrawImage bg, 0, 0, akt

If KeyHit(78) Then
   If akt = 5 Then akt = -1
   If akt <> 5 Then akt = akt + 1
EndIf

If KeyHit(74) Then
   If akt = 0 Then akt = 6
   If akt <> 0 Then akt = akt - 1
EndIf
Text 12, 7, akt + "X: " + posx + " Y: " + posy


If MouseDown(1) Then

   mapx = MouseX()/32
   mapy = MouseY()/32
   
   map(mapx-posx, mapy-posy) = akt

EndIf


If MouseDown(2) Then

   mapx = MouseX()/32
   mapy = MouseY()/32
   
   map(mapx-posx, mapy-posy) = 0

EndIf


; kollisions (nicht gut)

move = 1

For x=0 To 100

   For y=0 To 100

      If ImagesCollide(pl, 400, 300, 0, bg, x*32, y*32, map(x-posx, y-posy)) Then move = 0
      
   Next

Next

;laufen

If move = 1 Then

If KeyDown(208) Then ; hoch

If posy <> -100 Then posy = posy - .1

EndIf
If KeyDown(200) Then ; runter
   
If posy <> 0 Then posy = posy  + .1

EndIf

If KeyDown(205) Then ; links

If posx <> -100 Then posx = posx  -.1

EndIf

If KeyDown(203) Then ;rechts
   
If posx <> 0 Then posx = posx  +.1

EndIf

EndIf

; spicher und laden

If KeyHit(31) Then

posx = -12
posy = -9

   karte$ = WriteFile("map1.map")
   
   For x = 0 To 100
      For y = 0 To 100
         
         WriteLine(karte$,akt)
         WriteInt(karte$,map(x-posx,y-posy))
         
      Next
   Next
   
   CloseFile(karte$)

EndIf

If KeyHit(38) Then
   
posx = -12
posy = -9
   
   karte$ = ReadFile("map1.map")
   
   For x = 0 To 100
      For y = 0 To 100
      
         akt = ReadLine(karte$)
         map(x-posx,y-posy) = ReadInt(karte$)
         
      Next
   Next
   
   CloseFile(karte$)

EndIf

; spieler in die mitte setzen

DrawImage pl, 400, 300

Flip


Wend


Hier nochmal der komplette Ordner mit Grafiken und Map.
test.zip

Vielen Dank für eure Hilfe.
 

DjDETE

BeitragSa, März 28, 2009 16:42
Antworten mit Zitat
Benutzer-Profile anzeigen
schau dir mal das tutorial zum pixel-by-tile scrolling an.
https://www.blitzforum.de/upload/file.php?id=3909
MfG DeTe
Aktuelles Projekt: XXX |XXX | 3% der v1b fertig
www.emu-soft.de.vu Für die Homepage suche ich noch Linktauschpartner, bei Interesse einfach melden.
 

marcelm

BeitragSa, März 28, 2009 17:35
Antworten mit Zitat
Benutzer-Profile anzeigen
Danke, habs hinbekommen

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group