Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smooothness
#1
I was just messing around with a particle fountain. Sometimes the program runs smoothly, but if I change the _limit a little it can become hurky-jerky. Like the below seems to do great at 60 or 80 FPS, though runs less smoothly at 50 or 70. Is it my laptop?  Is smoothness in graphics always a dance between run-speed and the number of pixels that items move per cycle?  I'm curious how this could be made to run smoothly at various _limits. Any thoughts or insights appreciated!

Code: (Select All)
OPTION _EXPLICIT
SCREEN _NEWIMAGE(1280, 720, 32)
RANDOMIZE TIMER: _MOUSEHIDE
_DELAY .25: _SCREENMOVE _MIDDLE

TYPE particle
    x AS SINGLE
    y AS SINGLE
    Vx AS SINGLE
    Vy AS SINGLE
END TYPE

DIM AS INTEGER c
DIM AS particle p(200)

start:
c = -1
DO '
    c = c + 1 '                                   init particles
    p(c).x = _WIDTH / 2
    p(c).y = c * -5 - 140
    p(c).Vx = 0
    p(c).Vy = 3 + (RND - RND) / 4
LOOP UNTIL c = UBOUND(p)

DO
    c = -1
    CLS
    _LIMIT 60
    DO '                                            move em
        c = c + 1
        p(c).x = p(c).x + p(c).Vx
        p(c).y = p(c).y + p(c).Vy
        IF p(c).y > 20 AND p(c).y < 26 THEN p(c).Vx = (RND - RND) / 1.75 '  only change em once
        IF p(c).y > 14 THEN p(c).Vy = p(c).Vy + .06 '  a little gravity
    LOOP UNTIL c = UBOUND(p)

    c = -1
    DO '                                            draw em
        c = c + 1
        PSET (p(c).x, p(c).y), _RGB32(255)
    LOOP UNTIL c = UBOUND(p)

    _DISPLAY
    IF p(200).y > _HEIGHT + 140 THEN GOTO start
LOOP UNTIL _KEYDOWN(27)
SYSTEM
Reply


Messages In This Thread
Smooothness - by NakedApe - 10-10-2024, 10:31 PM
RE: Smooothness - by bplus - 10-10-2024, 10:38 PM
RE: Smooothness - by NakedApe - 10-11-2024, 01:22 AM
RE: Smooothness - by SMcNeill - 10-11-2024, 01:54 AM
RE: Smooothness - by NakedApe - 10-11-2024, 05:26 AM
RE: Smooothness - by DSMan195276 - 10-11-2024, 05:29 AM
RE: Smooothness - by NakedApe - 10-13-2024, 03:57 PM
RE: Smooothness - by SMcNeill - 10-13-2024, 05:42 PM
RE: Smooothness - by bplus - 10-13-2024, 07:02 AM
RE: Smooothness - by NakedApe - 10-13-2024, 07:37 PM



Users browsing this thread: 2 Guest(s)