Frame Unabhängig?
Übersicht

JeyBetreff: Frame Unabhängig? |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hallo, ich versuche gerade, die Bewegungsgeschwindigkeit meines Charakters konstant zu halten, egal welchen frameanzahl ich habe.
Dazu benutze ich folgenden Code aus dem Forum Code: [AUSKLAPPEN] RT#=(MilliSecs()-timer)/1000 : timer#=MilliSecs() meine bewegung schaut dann so etwa aus: Code: [AUSKLAPPEN] px#=px#+speed*RT# Nur leider ruckelt das ziemlich, also die bewegung ist gerade nicht konstant. Vieleicht hab ich da irgend ein Fehler gemacht jedoch arbeite ich an einem Multiplayergame, wo schließlich alle Spieler gleich schnell sein sollten ![]() |
||
![]() |
D2006Administrator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi,
probier mal: Code: [AUSKLAPPEN] RT#=(MilliSecs()-timer)/1000.0 : timer#=MilliSecs()
Liegt wohl an der Integer Division. MfG D2006 |
||
Intel Core i5 2500 | 16 GB DDR3 RAM dualchannel | ATI Radeon HD6870 (1024 MB RAM) | Windows 7 Home Premium
Intel Core 2 Duo 2.4 GHz | 2 GB DDR3 RAM dualchannel | Nvidia GeForce 9400M (256 MB shared RAM) | Mac OS X Snow Leopard Intel Pentium Dual-Core 2.4 GHz | 3 GB DDR2 RAM dualchannel | ATI Radeon HD3850 (1024 MB RAM) | Windows 7 Home Premium Chaos Interactive :: GoBang :: BB-Poker :: ChaosBreaker :: Hexagon :: ChaosRacer 2 |
![]() |
Dante |
![]() Antworten mit Zitat ![]() |
---|---|---|
vieleicht hilft das.
bei mir rucklt da dann nix^^ Edit: voher aber ne Sek warten bis der das berechnet hat, sonst springt der zu weit. Code: [AUSKLAPPEN] Graphics 800,600, 0, 2
SetBuffer BackBuffer() Global frames# = 0.0, fpstime# = 0.0, fps# = 0.0 Global speed# = 150.0, tempo# = 0, x# = 0.0, y# = 0.0 Repeat Cls getFPS() timer# = (1.0 / fps#) tempo# = speed# * timer# If KeyDown(205) x# = x# + tempo# EndIf If KeyDown(203) x# = x# - tempo# EndIf If KeyDown(200) y# = y# - tempo# EndIf If KeyDown(208) y# = y# + tempo# EndIf Rect x#, y#, 32, 32, 0 Text 0, 0, "Speed:" + tempo# Text 730, 0, "FPS:" + Int(fps#) Flip Until KeyDown(1) Function getFPS() frames# = frames# + 1 If fpstime# + 1001.0 < MilliSecs() fps# = frames# frames# = 0.0 fpstime# = MilliSecs() EndIf End Function |
||
- Zuletzt bearbeitet von Dante am Di, Nov 01, 2005 12:22, insgesamt 2-mal bearbeitet
Jey |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Danke für die Antwort, bei mir muss es sich nur um einen Rundungsfehler gehandelt haben ![]() |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group