Slow down scrolling

Advanced game related topics
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

Slow down scrolling

Post by Brujah »

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.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

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.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

you can also join the German forums, perhaps it's easier for you there... ;)

http://www.purebasic.fr/german/
oh... and have a nice day.
hellhound66
Enthusiast
Enthusiast
Posts: 119
Joined: Tue Feb 21, 2006 12:37 pm

Post by hellhound66 »

Removed.
Last edited by hellhound66 on Wed Mar 19, 2008 11:32 pm, edited 1 time in total.
lethalpolux
Enthusiast
Enthusiast
Posts: 171
Joined: Sun Jun 08, 2003 10:50 pm
Location: France
Contact:

Post by lethalpolux »

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.
Pol.
Intel Core2Duo 6600 - 3Gb DDR2 - Geforce8800Gts - Vista Home Premium 32bits
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

But wouldn't this rely on the speed of the computer as it is simply a counter system, not tied into any frame refresh etc.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

the most simple version of a timer:

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
this could be added to your existing code.
just put everything from your old mainloop into the If Action condition.
oh... and have a nice day.
Post Reply