Tiles
Moderator: Stef
Tiles
Hello Again!
I was wondering if anyone have a tile example. Because I dont want to make sprites of everything
There iare some tile examples, but they are always hardcoded into memory. I was wondering if it was possible with a png image and some cool SGDK commands
I was wondering if anyone have a tile example. Because I dont want to make sprites of everything
There iare some tile examples, but they are always hardcoded into memory. I was wondering if it was possible with a png image and some cool SGDK commands
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Tiles
Of course you can load GFX data from iamge (BMP or PNG).
Look at the "sprite" sample provided in SGDK :
https://github.com/Stephane-D/SGDK/tree ... ple/sprite
If you go into the "res" folder you will see some .res files declaring resources.
Rescomp tool will compile the resources into .s / .h file for you. you can read the rescomp.txt file (in the "bin" folder of SGDK) to see which kind of resource are supported
Look at the "sprite" sample provided in SGDK :
https://github.com/Stephane-D/SGDK/tree ... ple/sprite
If you go into the "res" folder you will see some .res files declaring resources.
Rescomp tool will compile the resources into .s / .h file for you. you can read the rescomp.txt file (in the "bin" folder of SGDK) to see which kind of resource are supported
Re: Tiles
Well, I have a tileset resource that exist as a resource in my code, but I dont know how to use it in any functions....
Havent found a single example that loads my tileset. Tried to use the same funktions as the hardcoded tileset in sprite example, but didnt work.
Havent found a single example that loads my tileset. Tried to use the same funktions as the hardcoded tileset in sprite example, but didnt work.
Re: Tiles
I solved the above by looking at my own Tile Array and doing some math. Feels like the wrong way but it works.
I was also wondering about the best way to animate tiles. Is the vdp_drawimage function fast enough?
I will have a water tile with waves or something.
I was also wondering about the best way to animate tiles. Is the vdp_drawimage function fast enough?
I will have a water tile with waves or something.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: Tiles
About looking what map tile is behind your sprite, you should do it from your map data.
As you know the sprite position in the level so you should be able to find which background tile is behind the sprite just by using its coordinates / 8 or something like that
Also about animating background, it's better to have a large image containing the different water animation and just use VDP_setMapEx(..) to refresh only a part of the tilemap with a specific region of your map image.
As you know the sprite position in the level so you should be able to find which background tile is behind the sprite just by using its coordinates / 8 or something like that
Also about animating background, it's better to have a large image containing the different water animation and just use VDP_setMapEx(..) to refresh only a part of the tilemap with a specific region of your map image.