The game in question is Megaman 1.
Basically, I want to make a robot master of mine be able to jump and land exactly where Megaman is, on Megaman's X position, which is horizontal.
I came up with alot of information about some things that could help, and right now, I did managed to make it work, but only with a very low jump Height. The logic that I came out was: set sprite id, set animation related command, set jump height whole value as 6, set jump height fractionated value as 20, set the carry to 1, load Megaman's X position, subtract with the boss's X position, add the whole value to the jump distance whole command and the remainder (in the carry, probably) as the value of the jump distance fractionated command, call a function to make the boss jump at the direction that I am (left or right), move to the next boss code, end (rts)
Obs: the fractionated commands goes from 00 to FF (0 to 255), and the whole commands goes uses 256 as a base for the value (which means value 01 makes it move 1 pixel per frame, representing 256. Value 2 represents 512, etc.)
Is this logic correct? If not, I want to know what I did wrong on it, because I want to understand these things better to improve my coding skill.
Thanks~
Trying to understand a specific jumping code for a boss
Moderator: Moderators
Re: Trying to understand a specific jumping code for a boss
Mega Man 2 literally did exactly that with Quick Man. See the Video by Displaced Gamers.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Trying to understand a specific jumping code for a boss
I watched that video a couple of months ago, and I completly forgot that they had this information. I did not even knew that Quick Man uses this logic too (which actually explain why his jumps are like that). Thank you very, very much for pointing it out!
The hardest part of it was to find the right way to handle the remainder value after the division, but after some hard work, I found it out and I finally made the whole code to work.
Thank you very much, once again~
The hardest part of it was to find the right way to handle the remainder value after the division, but after some hard work, I found it out and I finally made the whole code to work.
Thank you very much, once again~