The tiltlescreen of my game is scrolling way too fast on my new computer. On my old one it was exactely right. Same for the actual scrolling in the game.
How can I slow this down that its still scrolling fast enough on older machines but scrolls slower on faster machines?
I display it like this:
ClipSprite(#SPRITE_TILESET_SPLASH1, xxx, 0, 640, 480)
DisplaySprite(#SPRITE_TILESET_SPLASH1, 0, 0)
And I increase/decrease xxx everytime.
Slow down scrolling
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
Well, you need to built in same sort of frame limiting technique. For windowed mode you can use the native PB command SetFramerate() and for fullscreen games SetRefreshrate(). Be sure to check out the the remarks for each command.
Other than these two there are quite a lot of different techniques to limit the FPS to a certain rate. You may try a forum search, there should be some useful posts.
Other than these two there are quite a lot of different techniques to limit the FPS to a certain rate. You may try a forum search, there should be some useful posts.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
you can also join the German forums, perhaps it's easier for you there... 
http://www.purebasic.fr/german/

http://www.purebasic.fr/german/
oh... and have a nice day.
-
- Enthusiast
- Posts: 119
- Joined: Tue Feb 21, 2006 12:37 pm
-
- Enthusiast
- Posts: 171
- Joined: Sun Jun 08, 2003 10:50 pm
- Location: France
- Contact:
or the simple way, you apply a timer/flag.
global timeb.l,slow.l
slow=4
ClipSprite(#SPRITE_TILESET_SPLASH1, xxx, 0, 640, 480)
DisplaySprite(#SPRITE_TILESET_SPLASH1, 0, 0)
timeb+1
if timeb=slow
xxx+1
timeb=0
endif
with this you don't need to limit the fps and can adjust the speed for every scrolls/anims on your game.
global timeb.l,slow.l
slow=4
ClipSprite(#SPRITE_TILESET_SPLASH1, xxx, 0, 640, 480)
DisplaySprite(#SPRITE_TILESET_SPLASH1, 0, 0)
timeb+1
if timeb=slow
xxx+1
timeb=0
endif
with this you don't need to limit the fps and can adjust the speed for every scrolls/anims on your game.
Pol.
Intel Core2Duo 6600 - 3Gb DDR2 - Geforce8800Gts - Vista Home Premium 32bits
Intel Core2Duo 6600 - 3Gb DDR2 - Geforce8800Gts - Vista Home Premium 32bits
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
the most simple version of a timer:
this could be added to your existing code.
just put everything from your old mainloop into the If Action condition.
Code: Select all
#FrameDuration = 40 ; do it with 25 FPS
FrameTimer.l = ElapsedMilliseconds() + #FrameDuration
Repeat ; permanent loop of indefinite frequency
; *****************
; setting a flag when time is over
Action = 0
If ElapsedMilliseconds() > FrameTimer
FrameTimer + #FrameDuration
Action = 1
EndIf
; *****************
If Action
; everything you want to do
EndIf
Until EXIT
just put everything from your old mainloop into the If Action condition.
oh... and have a nice day.