Weird problem with sprites
Posted: Tue May 14, 2019 5:01 pm
Hi,
Just for learning how to work with the SGDK and before facing more complex projects, I'm coding a port of Jetpac from ZX Spectrum. I have no previous experience coding games at all and it's quite some years since I touch C for the last time, so I'm starting from scratch almost in every aspect.
I have more or less ready the structure of the levels, the jetman movement, the basic behavior of the enemies, the physics and the collisions between them (everything "inspired" by the samples coming with the SGDK). For sure not in a very orthodox nor optimal way, but that will come later.
I have 2 different modes, a ZX mode where I'm trying to replicate the ZX original pixel perfect and a MD mode where I'm adding some changes, e.g. the platforms are not always located in the same positions.
So far so good.
The thing is yesterday I started to work on the spaceship and I've run into a problem with the sprites. In the first level the rocket starts broken in 3 different parts, each in a different position. No behavior or collisions yet, just displaying the 3 parts (each part is a sprite).
The problem. When started in the ZX mode the 3 parts are displayed well, but when started in MD mode the sprites are corrupt, they look kind of mingled with the sprite of the jetman.
See a couple of screen captures:
The thing is the code that creates the sprites is exactly the same. Nothing changes. One thing: The rocket sprites are created right before the jetman, if I do it right after then they still are shown corrupt, but only one of the parts.
The code is already upgraded to SGDK 1.40, but the same happened with 1.34.
This happens with Gens Kmod as well as in real hardware, though in the real MD after 3 or 4 times that the MD level is started they are displayed well.
This is a very simple scenario so I'm sure I'm missing something. Anyone has any clue what might be cause?
The problem is reproduced in this branch:
https://github.com/diegomtassis/md-jetp ... pt_md-mode
And this is the bin:
https://github.com/diegomtassis/md-jetp ... ut/rom.bin
Just for learning how to work with the SGDK and before facing more complex projects, I'm coding a port of Jetpac from ZX Spectrum. I have no previous experience coding games at all and it's quite some years since I touch C for the last time, so I'm starting from scratch almost in every aspect.
I have more or less ready the structure of the levels, the jetman movement, the basic behavior of the enemies, the physics and the collisions between them (everything "inspired" by the samples coming with the SGDK). For sure not in a very orthodox nor optimal way, but that will come later.
I have 2 different modes, a ZX mode where I'm trying to replicate the ZX original pixel perfect and a MD mode where I'm adding some changes, e.g. the platforms are not always located in the same positions.
So far so good.
The thing is yesterday I started to work on the spaceship and I've run into a problem with the sprites. In the first level the rocket starts broken in 3 different parts, each in a different position. No behavior or collisions yet, just displaying the 3 parts (each part is a sprite).
The problem. When started in the ZX mode the 3 parts are displayed well, but when started in MD mode the sprites are corrupt, they look kind of mingled with the sprite of the jetman.
See a couple of screen captures:
The thing is the code that creates the sprites is exactly the same. Nothing changes. One thing: The rocket sprites are created right before the jetman, if I do it right after then they still are shown corrupt, but only one of the parts.
The code is already upgraded to SGDK 1.40, but the same happened with 1.34.
This happens with Gens Kmod as well as in real hardware, though in the real MD after 3 or 4 times that the MD level is started they are displayed well.
This is a very simple scenario so I'm sure I'm missing something. Anyone has any clue what might be cause?
The problem is reproduced in this branch:
https://github.com/diegomtassis/md-jetp ... pt_md-mode
And this is the bin:
https://github.com/diegomtassis/md-jetp ... ut/rom.bin