Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sprites & ATTR
#1
Hi,

I'm quite new to ZX Basic, and just had a few questions:

Is the replacement for the Sinclair BASIC ATTR command attrAdress(x,y)?

Are there any linked sprite libraries that let you use Sprites (larger than 8*8) from BASIC? I did look at the Spanish Fourspriter tutorial, but Google translate is not great with technical translations. Is there an English Language tutorial, and are there any other libraries, without the need to use Assembler?

Thanks
Reply
#2
jonesypeter Wrote:Hi,

I'm quite new to ZX Basic, and just had a few questions:

Is the replacement for the Sinclair BASIC ATTR command attrAdress(x,y)?

Are there any linked sprite libraries that let you use Sprites (larger than 8*8) from BASIC? I did look at the Spanish Fourspriter tutorial, but Google translate is not great with technical translations. Is there an English Language tutorial, and are there any other libraries, without the need to use Assembler?

Thanks
Hi, joneyspeter

The function is ATTR(y, x) as in SINCLAIR BASIC. But you must start your program with #include <attr.bas> at the beginning:
Code:
#include <attr.bas>

PRINT AT 4, 5; INK 6; PAPER 1; "."
PRINT ATTR(4, 5)
Reply
#3
You can certainly get fourspriter to work - and in fact I did some optimization of it

<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/how-to-tutorials/topic397.html">how-to-tutorials/topic397.html</a><!-- l -->

<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/how-to-tutorials/topic400.html">how-to-tutorials/topic400.html</a><!-- l -->
<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/how-to-tutorials/topic402.html">how-to-tutorials/topic402.html</a><!-- l -->


And don't forget to look in the library: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Library">http://www.boriel.com/wiki/en/index.php ... IC:Library</a><!-- m -->

Specifically, have a look at High Res Print, and High Res Print Fast in the library:

<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:HRprint.bas">http://www.boriel.com/wiki/en/index.php ... Rprint.bas</a><!-- m -->

This has an example of moving the gentle sprite around by pixels. It's far from automated, but it's /a/ basis for a sprite routine. It's also possible to use it in OVER 1 mode, iirc, so you can protect the background by merging it and then reprinting the same thing to restore.

<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:HRPrintFast.bas">http://www.boriel.com/wiki/en/index.php ... ntFast.bas</a><!-- m -->

Same as the original, but uses lookup tables to do screen addressing, rather than calculations. This makes it about 20% or so faster to print a character, but does make the code much larger as the tables take up space.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)