I was looking through the mega man x RAM and I noticed tons of objects such as enemies and the player are state-based. But the weird thing is how they are used, like, states go 0, 2, 4, 6, 8, 10, 12 etc... not 0, 1, 2, 3, 4, etc... which in my opinion is pretty weird. I tried poking them and setting them to uneven values and every time, it just instantly froze the game.
What I am asking is, could there any actual technical reason for this or is it just completely arbitrary?
Please excuse me if any of my questions are dumb or annoying, I'm just trying to learn slowly and ask fro help so I can understand things that I don't understand yet.
Question about object states in mega man x
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
-
- Posts: 24
- Joined: Sun Dec 18, 2016 1:11 pm
Re: Question about object states in mega man x
Sounds to me like they have a table of addresses that lead to code for each given "state". If each entry in the table is two bytes long, then having the states increment by two each time eliminates an instruction to multiply by two when using said table. And using an odd number would cause the program to jump to an invalid address which uuuusually crashes right away.
-
- Posts: 24
- Joined: Sun Dec 18, 2016 1:11 pm
Re: Question about object states in mega man x
Makes sense, thanks.