Log In  

Cart #xor_flower-0 | 2019-09-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Years ago computers had very little memory. I am reminded of the Apple ][ computer which although having 2-HIRES graphic pages each 8192-bytes in size with a resolution of 280x192 B&W pixels, you only had about 16k of RAM space if you used both of them for your program.

The original method was to plot an image on one page while viewing the other, then swap the two so you were always plotting on one while viewing the other. Yet this technique cost two HIRES pages of memory.

So a new method was adopted to handle plotting sprites and graphics over existing static images, and that method was called XOR.

On the Apple for instance you could plot a shape with XOR dots, that is for every pre-existing black dot you plotted on, it would appear white. Likewise if you plotted on a previously existing white dot, the plotting color for your dot would be black.

To erase the shape you would repeat the drawing exactly which would also recover the background beneath it - and this method only required the use of one HIRES page instead of the need for two so you could program in an additional 8192-bytes of code for your program, critical to many video-games that many years ago.

XOR also does some interesting graphic effects. If you XPLOT a line and then plot ANOTHER XOR LINE almost exactly like it but at a slightly different angle you can an interesting kind of warped box effect or flower as you see here.

Now as you cannot XPLOT a LINE in Pico-8, I wrote a routine to do just that for you called PLINE using coordinate arguments the same as LINE()(x1,y1,x2,y2).

So this cart is twofold, not only do you get a lovely mathematical flower but you can use this small coded PLINE() routine for your own works to have one target chase another, perhaps for your opponent to fire a shot at you despite where they are on the screen, or even just to simply draw a line changing color mid-step as you go.

It's up to you !

P#67910 2019-09-19 23:26 ( Edited 2019-09-19 23:43)


[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-08-08 09:13 | 0.016s | 4194k | Q:27