Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OVER - how it works?
#3
boriel Wrote:What version are you using? Please download the latest one (1.8.8 at the moment of writing) as it fixes lot of errors. In fact a bug with OVER 1 was fixed a while ago.

If you still experience issues, tell me.

OVER 1 means "Use OVER from now on".
OVER 0 means "Do not use over from now on". It does not affect what is on the screen already, but what's going to be draw.
It affects PRINT and drawing primitives (PLOT, DRAW, CIRCLE).

I am already using 1.8.8, and if OVER works as I thought, then something messed up and I don't know why Sad
For the sonar subroutine of Cargas de Produndidad/Depthcharge, I tweaked some of the code of the Clock2.bas but I couldn't implement the OVER sentence as the same way in Clock2.bas, because all graphics (ships, submarines, everything...) showed messed up after that.
Here is the code of the sonar subroutine, but you can check all source code of the game (the .7zip file contains it)
Code:
REM Rutina del sonar
SUB sonar()
    REM sonido del sonar
    segundos = segundos + 1
    if segundos = 15 then
        beep 0.07,45 : beep 0.13,30
        segundos = 0
    end if
    
    REM OVER 1 linea comentada ya que rompe los gráficos del resto del juego
    
    REM grafico del sonar    
    FUNCTION t AS ULONG
            RETURN INT((65536 * PEEK (23674) + 256 * PEEK(23673) + PEEK (23672))/50)
    END FUNCTION
    
    DIM t1 AS FLOAT

    t1 = t()
    a = t1 / 30 * PI: REM a is the seconds pointer in radians
    sx = 20 * SIN a : LET sy = 20 * COS a
    PLOT 237, 28: DRAW sx, sy

    t2 = t()
    PLOT 237, 28: DRAW sx, sy
    
    REM como poner OVER 1 al principio de la rutina y OVER 0 al final de la rutina hace que los graficos no se muestren correctamente, como workaround...
    REM se "barre" el sonar por completo cada cuarto de vuelta. Idealmente, el comportamiento deberia ser el mismo que el de una aguja del reloj.
    if sx > 19.9 or sx < -19.9 or (sx > 0 and sx < 3) then    
        resetsonar = resetsonar + 1
        if resetsonar = 1 then
            for y = 18 to 23
             print at y,27; "     ";
            next y
            CIRCLE 236, 28, 18
            CIRCLE 236, 28, 13
            CIRCLE 236, 28, 8
            plot 236,9 : draw 0,38
            plot 217,28 : draw 38,0
        end if
    else
        resetsonar = 0
    end if
    
    REM OVER 0 linea comentada ya que rompe los gráficos del resto del juego
    
END sub

Thanks!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)