Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mirror a sprite
#3
britlion Wrote:What was the problem Oblo?

Read: <!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/how-to-tutorials/tutorial-how-to-put-inline-assembly-functions-into-zx-basic-t729.html?hilit=mirror">how-to-tutorials/tutorial-how-to-put-inline-assembly-functions-into-zx-basic-t729.html?hilit=mirror</a><!-- l -->

This is the discussion where that came about. The fastest mirror solution is the one at the bottom of the page you linked to - faster and shorter by far than any other solution I've seen, though the maths are a bit brain aching if you try to understand how it does it.

If you want to vertically mirror, it's a matter of swapping the byte order - so instead of first byte to last, you read it last byte to first. Easier if you just peek then poke to your sprite buffer in forward or reverse order when switching the up/down direction.

Left to right you read the bytes into your live sprite buffer poke sprite1, peek (data1) Right to left, you do poke sprite1, hmirror(peek data1)

Thanks for your rapid response, britlion. The syntax, what's the correct one? For instance, if I want to use the UDG \A, hmirror(\A), hmirror("\A") or hmirror(peek 23675) fails.

EDIT: I've just got to understand it. The function mirrors something it's already printed on the screen, but don't mirror sprites "on the go" (that's what's I was looking for Sad )

Cheers.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)