Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NextBuild sprites
#1
Been using NextBuild for a little while, mucking around with my own editor for creating maps/sprs etc, got my scrolling tilemap working, but have hit a bit of a wall with sprites.
Ok so as far as I can gather the Next can handle 64 hardware sprites with 256 colours, or 128 hardware sprites with 16 colours (4bit).

When I use the InitSprites command I think this loads in upto 64 (or 128 for 4bit) sprites into the video memory (max is 16k). Then when I use UpdateSprite I can assign one of those sprite images (patterns in code) to a sprite ID. So I can use the same sprite image many times for my 64 onscreen sprites.

All good, except my main player is 4 sprites (32x32). It can move in 8 directions, and there are 5 animation frames. So in total 160 sprites just for the player.

So I'm running out of sprites. Now before I go mucking around reducing graphics to single sprite sizes, or using flipping/mirroring etc, then is it possible to use InitSprites, or some other command, to force load new images over the loaded ones? I was thinking of keeping the first 4 sprites just for the player and then just initialising those 4 sprites as the animation or direction changes. A quick test of using InitSprites (for the full 64 sprites) every frame shows this doesn't slow things down badly, so hopefully is possible. I don't really know ASM well enough to alter the InitSprites, but basically would be the same but with a starting point (so can init just the first 4 sprite, then the next 4 sprites (eg. for enemy)). 

Also is it possible to use 8bit graphics (256 colour) for the layer 2 tilemap, and 4bit graphics (16 colour) for the sprites?
Reply
#2
Hi,

You can use the next DMA to effectively have unlimited sprite images.

See example here.

https://github.com/em00k/ninja-sprite-dma

You can also use 4 bit sprites independently of the display mode underneath e.g. Layer 2, hardware tilemap etc.
Reply
#3
Yes I saw the Ninja example on FB/Discord after I posted here. Also been confirmed that the v8 DMA code will work in v7. Will have to have a good look. Thanks for posting though.

Interesting about the 4 bit sprites. Just noticed the example project in NextBuild. Thanks for the comments!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)