Z-TEAM
What's a PC Engine?
Posts: 3
|
Post by Z-TEAM on Feb 15, 2020 11:57:13 GMT
Hi Everyone I start to use the functions in HUC, with maps in fmp format for 8x8 tiles, I have the index of the tile but if I use the Promotion stm format to make maps of 16x16 tiles, I don't understand what the get_map_tile function returns. Someone has already tested ? Thx
|
|
|
Post by DarkKobold on Feb 15, 2020 14:58:32 GMT
Hi, if you are in 16x16 mode, you give it a map location in X/Y coordinates, and it returns the tile # in question. For example, here's my ladder collision code:
if ((joypad& JOY_UP) || (joypad & JOY_DOWN)) { PtX1=(PlayerX+16)/16 + MapX; PtY1=(PlayerY+16)/16 + MapY; temp1=map_get_tile(PtX1,PtY1); if ((temp1>9) && (temp1 < 16)) { PtX1-=MapX; PlayerX=(PtX1*16)-8; PlayerYSpeed=0; PlayerState=PLAYER_CLIMB; PlayerAnimTimer=4; PlayerAnimState=10; PlayerXSpeed=0; } }
It takes the center of the player on the screen (PlayerX+16) and (PlayerY+16) divides by the tile size (/16) and then adds in the current screen on the map (+MapX) and (+MapY). Tiles 10 through 15 are climbable tiles in my promotion file.
|
|
Z-TEAM
What's a PC Engine?
Posts: 3
|
Post by Z-TEAM on Mar 15, 2020 20:02:59 GMT
Thx DarkKobold, in 16x16 mode, what is the tile index in for the function put_tile ? I try to change a tile after load a map, but the tile doesn't c match. Thx again
|
|
|
Post by DarkKobold on Mar 15, 2020 20:56:56 GMT
Thx DarkKobold, in 16x16 mode, what is the tile index in for the function put_tile ? I try to change a tile after load a map, but the tile doesn't c match. Thx again Hi Z-TEAM, note that map_get_tile only checks against the map stored in the ROM, not the tiles you have on screen. I made that mistake earlier too. If you need to know what tiles are on screen, you'll have to make your own buffer, or find a different solution. For doors and moving platforms, I use sprites.
Also, generally speaking, put-tile fails often. I have no idea why. I instead use "load_map" to overwrite tiles on screen.
|
|
Z-TEAM
What's a PC Engine?
Posts: 3
|
Post by Z-TEAM on Mar 18, 2020 6:03:03 GMT
Hi, I intended to use these functions to animate single tile, there are no other techniques?
|
|
|
Post by turboxray on Mar 18, 2020 15:11:50 GMT
Hi, I intended to use these functions to animate single tile, there are no other techniques? You could update the tile itself that the map is pointing to? Depending on how many are on a given screen (and/or if you're scrolling the screen), it might actually be faster that way. Depending on what the update animation is, you could potentially also dedicate a subpalette to it and just update that subpalette data - though that's the same size as a single 8x8 tile so...
|
|
|
Post by monstersgoboom on Mar 18, 2020 17:53:26 GMT
Hi, I intended to use these functions to animate single tile, there are no other techniques? I'd suggest using load_vram to upload animations over the tile graphics themselves for animations like that. As shown here I'm uploading the 32x32 pixel sprite frames as needed to vram, 512 bytes each. the white bar is the logic and upload hitch. you should easily manage a few tiles.
|
|