Firstly, I am so glad we have the forums back (Although unfortunately this site is blocked on my work PC... spheredev.org wasn't :( ) !
Now I move onto my question.
I decided I wanted to learn how 2d sidescrollers work. Specifically Super Metroid for the SNES.
Now I tried figuring it for myself and movement just seemed odd? So I spent a few hours researching on the net although I found some help it was hard to find anything fit-for-purpose.
Again I got close but odd movement, and it didn't seem adaptable at all.
I really wanna keep the floaty-ness of super Metroid, but also for collision I need a way to be more precise with collision (In Metroid your current sprite frames height is taken into consideration, im guessing at least when you consider the morphball)
Can anyone get me started?
To make it more 'floaty', you can reduce the gravity constant.
delta_time = GetTime() - last_time;
last_time = GetTime();
And then when you update the position of the units
That's how I did it in Organ Grinder (which had poor obstructions, but I felt decent gravity mechanics).
As far as height, I don't know about Super Metroid but Metroid and Metroid II had you two tiles tall by one tile wide, and in morphball form you were just one by one, I think?
Yeah that's right
I got this so far :
const gravity = 1000;
const dt = 1 / 60;
for (var i = 0; i < entities.length; i++)
// we still need to check collision
entities[i].vSpeed = entities[i].vSpeed + (gravity - entities[i].drag) * dt;
if (drag < gravity) entities[i].drag *= 2;
entities[i].y = entities[i].y + entities[i].vSpeed * dt;
Somethings not right though. I been watching a sprite bouncing up and down trying to get it right for hours now lol
One thing I did to make jumps seem better was to space out the increase (or it looks like decrease for how you're doing it) to the vertical trajectory over about a quarter second. That might make it feel better. I mainly did it because it didn't look right to me with an instantaneous boost.
To make it more like Metroid, you might want to make the terminal velocity lower, but the gravity constant higher? Or to make the total height gained between touching the ground limited? I know that fudges the physics a bit, but if that makes it feel more like what you want it to, there's absolutely nothing stopping it from working that way.
Simulating drag, too? I never bothered with that, but power to you if it works.
I sorta got it now.
For now I am not using drag, my internet search told me that was the best way to decide a max speed but upon further thinking maybe just capping the speed would be easier?
Using my current method I am finding it pretty hard to define how high you can jump, but ill get it soon. Having the a factor for speed that's affected by another factor of gravity means its not a simple as jump(number_pixels)
thought id through in a pic (I have mapped this area but had some layers invisible)
Eeeeek, how cool!!!! This screen makes me want to play metroid!
I just had to, in order to get all the gear so I could reverse engineer it. Fab game, but short :)
I thought id work on the animation mechanics now but man theres so many animations and causes for them! wow...