How To

Animate background tiles

2

TheSailor 2023-02-12 04:34

I've been looking around the documents and the forum but don't see it mentioned. So is it not possible to animate a background tile?


GAMELEGEND 2023-02-12 05:13

It is possible

I don't know if there is any other way to do it but the way I did it to make this conveyer belt I used the characters 1,2, and 3 and had the graphics for the conveyer belt in 4,5, and 6 and then I copied the data from 4,5, and 6 to 1,2, and 3
and because the character number for the cells I set are 1,2, and 3 you see a moving conveyer belt.

Was8bit has released multiple very good examples just type animated in the search bar.

Roboier.nx | Open in app
2023-02-12 05:13

nathanielbabiak 2023-02-12 05:35 (Edited)

Yes, it's not terrible.

To get up-to-speed, read the manual section "Advanced Topics", but only "Memory Map" and "Character data".

To animate a background tile, you need to:

For example, suppose you have a 4-character animation saved in ROM(2) in characters 8, 9, 10, and 11, and you want to animate it into character data (RAM) in character 32...

ON VBL CALL MY_ANIM
SUB MY_ANIM
  COPY ROM(2)+16*(8+(TIMER MOD 4)), $8000+16*32
END SUB


TheSailor 2023-02-12 05:49

Thanks guys. Appreciate you breaking it down for me. I'll play with the code examples you've given. From what I can see @nathanielbabiak is closer to what I was after but having the conveyor stage on my game use tiles instead of sprites would help with the collision checking I think. So that's also helpful @GAMELEGEND


TheSailor 2023-02-14 16:04

That code snippet you gave me doesn't seem to work...

Animation characters saved in ROM 2
(112,113,114)

BG saved in ROM 7
Empty character used in background is character 97


The code snippet using your framework...
COPY ROM(2)+16*(112+(TIMER MOD 3)), $8000+16*97


McPepic 2023-02-14 18:26

@TheSailor
Try:
COPY ROM(2)+16*(112+(TIMER MOD 3)), 16 TO $8000+16*97


nathanielbabiak 2023-02-14 23:05

Sorry, I forgot the "16 TO" that needs to sneak its way into the COPY instruction just after the comma...


TheSailor 2023-02-15 06:31

Yeah that makes sense now. You have to copy the 16 bits to the character specified. That worked. Thanks! Now to get the crate tiles moving along the conveyor 🤣


TheSailor 2023-02-15 13:50

Okay I threw in the towel and changed the crates back to full sprites. 🙄


Timo 2023-02-16 10:30

Yes, if you want to move objects pixel by pixel, then sprites are the way to go. On the BG you can only change things cell based.


TheSailor 2023-02-16 10:54

I definitely used the hard way to find that out 🤣


Log in to reply.