I would copy the X / Y coordinates to match the positions 8x8 on the BGR (NT PPU) screen. It is a similar method of placing an object on the screen as it is in Bomber Man. I managed to get a LO byte from a PPU address, but I have a problem with HI byte (20xx-23xx). It seemed to me more simple, but of course ...: /

I would still need a method of calculating the PPU address of the tiles to the X / Y coordinate of the sprite. I need this to determine the X / Y co-ordinates of a collision during a bomb explosion. Unfortunately, I was not able to simply copy the X / Y of the SPRITE position at the moment the bomb is placed, which is not set to the SPRITE position accuracy (the bomb is set to 16 pixels "step")

I'm trying to create a logical pattern, but of course I'm not going to take it in the code:

I'm not sure I understand what you need... Do you want to convert the coordinates back to pixel precision in order to test for collisions against sprites?

Normally, a game engine would not be doing this kind of conversion back and forth, but instead maintaining all objects in "level space", not "sprite space" or "name table space", since sprites and name tables are just details about how your game world is presented to the player, and these details could change significant if for some reason you decide to port the game to another platform. The game's engine should be able to function independently from these details.

The idea is to keep everything in level/world space at all times so that objects can interact with each other and the level map without problems, and do any coordinate conversions one way only, for drawing the objects on screen.

I'm not sure I understand what you need... Do you want to convert the coordinates back to pixel precision.

Yes exactly. PPU address, which is contained in the variables (when the bomb is placed on the screen):

BOMB_PPU_TILE1_AddrHIBOMB_PPU_TILE1_AddrLO

That is the first (left / top) of the four BGR bomb tiles. Convert this address to match a similar sprite on the screen (exactly as pictured).For example 21CA addres responds X50, Y70 of sprite position (6F - Considering that the Y position on the screen is not equal).

Generally speaking, a 16x16pix collision field (coordinates corresponding to the sprite position (x, y)) will be inserted on the screen where the exactly bomb will be placed (16x16pix area)

Instead of storing BOMB_PPU_TILE1_AddrHI and BOMB_PPU_TILE1_AddrLO, they're trying to recommend that you instead store the bomb's X and Y positions BOMB_X and BOMB_Y, and then convert those to BOMB_PPU_TILE1_AddrHI and BOMB_PPU_TILE1_AddrLO when updating the bomb's display.

You could just reverse the formula and account for the dimensions of the explosion, but like I said, I seriously advise against this. Explosions, after all, exist in the game world and interact with game entities, so there's no reason for them not to be game entities themselves.

Having one of your game objects represented exclusively as a set of NT addresses is a very hacky thing to do, because that information doesn't tell you directly where in the world the object is (hence why you need the conversion), only where in the screen it's drawn.

Keeping track of your objects always in level space is not only the professional thing to do, it's also easier to code and less error prone, since everything is unified and you don't have to constantly think of which space each thing lives in and do all sorts of space conversions to have them interact with each other.

Each object will have only one type of conversion, to translate its coordintes from level space to screen space so they can be displayed to the player. These conversions have to take into consideration whether the game objects are rendered using sprites or background, whether there's any scrolling, and whether there's anything shifting the gameplay window, such as status bars. No matter the type of conversion, they only go one way.

Who is online

Users browsing this forum: No registered users and 8 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum