tilemap question

cpc6128

Member
Licensed User
Hi, I have purchased & installed basic4ppc this afternoon and am well on my way to writing my first game already :)

My question is regarding tilemaps (where the game 'landscape' is made up of blocks read from a file and a character moves around on top)

I can create a 20x20 grid using sprites from the sprite library, but this makes the game slow to a crawl.
I can also create a 20x20 grid by using the DrawImage function and drawing directly onto the form, which is much faster because the tiles are not constantly updated every tick like they would be if they were sprites.
However, I cannot seem to combine the two techniques - i.e. using DrawImage to draw the tilemap and then using the sprite library to draw the main character, as when I initialise the GameWindow from the sprite library anything drawn on the form with DrawImage disappears.

Can these two techniques be used together? Or would it be best not to use the sprite library in this case? Or am I going about this in entirely the wrong way altogether?

thanks in advance
 

cpc6128

Member
Licensed User
I have made progress on this.

I can use DrawImage to draw the tilemap to the form, then I can use

gwGame.DrawBackgroundImage2(formGame.Image)

to set the GameWindow background to the tilemap that I have drawn.
This works, and allows me to then use a sprite on top.

Any comments on this topic would still be appreciated however!
 
Top