Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Sprite issue with vertical maps #255

Open
mbh21 opened this issue Sep 19, 2023 · 4 comments
Open

Regression: Sprite issue with vertical maps #255

mbh21 opened this issue Sep 19, 2023 · 4 comments

Comments

@mbh21
Copy link

mbh21 commented Sep 19, 2023

This was fixed in earlier 4.x dev branch, but now with 4.1 it is broken again.

When on a vertical map, if you move up or down on the map, then any sprites that scroll off the map, suddenly appear on the opposite side. So, if you move up, any sprites that go off bottom of map, appear at top. If you move down, any sprites that go off top of map, appear at bottom.

Previously this was fixed with sprite refresh settings, but this fix no longer works.

@mbh21
Copy link
Author

mbh21 commented Sep 19, 2023

Please see animated showing moving up and down. Only the middle goomba should be there, the others are ghosts. Attached is also code and sfc file.

0nogravityobjects
nogravityobject09.zip

@nub1604
Copy link
Contributor

nub1604 commented Sep 19, 2023

This behavior is normal on the Snes, take a look in the sprite viewer in Mesen when you moving vertically
To get around this, just draw the sprite out depending on your camera Y Position.
Try something like this:

    oambuffer[sprnum].oamx = (*goombaox) - x_pos; //  that was easy for X
    s16 posY = (*goombaoy) - y_pos;  //define posY on top of your c file, not method local like here
    if (posY > -16 && posY < 240) // play around with these values, in my case it works with a sprite size of 16
    {
        oambuffer[sprnum].oamy = posY; // if posY is in range it will draw
    }
    else
    {
        oambuffer[sprnum].oamy = 240; // otherwise draw the sprite it out of screen
    }
    oamDynamic16Draw(sprnum);

@mbh21
Copy link
Author

mbh21 commented Sep 19, 2023

Yes, but this was previously handled by the map engine.

@alekmaul
Copy link
Owner

that's correct, it was handle previously but the code was not correct. Is it possible to have your source code to check how you add your objects in the map?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants