FAQ  •  Register  •  Login

OVER - how it works?

<<

oblo

Posts: 96

Joined: Tue Jul 12, 2011 5:23 pm

Post Sun Nov 04, 2018 5:57 pm

OVER - how it works?

Hi all

While testing my last game, I come with some issue that makes me wonder if I understood well how OVER works. AFAIK, OVER 0 is the default mode, so if I have...
  Code:
OVER 1
PRINT "Hello";
OVER 0


... last OVER 0 will affect all screen and all PRINT, DRAW, CIRCLE, PLOT commands? Affect sprites that are already draw in screen? I had a strange behaviour with the sonar so I had to make a workaround. Anyway, I'd like to know how OVER really works.

Thanks and cheers.
<<

boriel

Site Admin

Posts: 1521

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue Nov 06, 2018 10:23 pm

Re: OVER - how it works?

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).
<<

oblo

Posts: 96

Joined: Tue Jul 12, 2011 5:23 pm

Post Tue Nov 06, 2018 10:59 pm

Re: OVER - how it works?

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 :(
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!

Return to ZX Basic Compiler

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO