When procedurally generating a map, how can I manipulate a tile's data to flip it as the picotron manual would suggest?




The following code seems to allow you to flip and place a map chip:
poke2({map address}, {flip flag} | {sprite number})
Specifically, it looks like this:
function _init() local sp_no = 1 poke2(0x100000, sp_no) poke2(0x100002, 0x2000 | 0x4000 | sp_no) poke2(0x100004, 0x4000 | 0x8000 | sp_no) poke2(0x100006, 0x2000 | 0x8000 | sp_no) end function _draw() cls() map(0, 0) end |
You should now be able to display map tips that rotate in 90 degree increments.

1


You don't need to poke memory, you can use mget and mset, or if it's a userdata, :set and :get.



ohh i didn't know you could use mset like that!
function _init() local sp_no = 1 mset(0,1, sp_no) mset(1,1, 0x2000 | 0x4000 | sp_no) mset(2,1, 0x4000 | 0x8000 | sp_no) mset(3,1, 0x2000 | 0x8000 | sp_no) end function _draw() cls(bg) map(0,0) end |
[Please log in to post a comment]