Hey. I tried to make a super mario - copy for myself in chilli framework, and after a few minutes of development i ran into a few errors. These files show how the mario object is animated to jump.
Can this be fixed somehow?
Infinite jumping
Infinite jumping
- Attachments
-
- sdw.JPG (29.39 KiB) Viewed 2312 times
-
- dwf.JPG
- (35.08 KiB) Not downloaded yet
Re: Infinite jumping
With infinite jumping, do you mean that you can double jump and stuff or do you mean that Mario is jumping whenever it hits the ground.
I needed similar physics a week ago, I'll send them here:
I'll continue looking at this, though.
Also, use { } with your if statement, although you're only executing one thing after the if statement. Because if one adds things one will often forget to add the parameters.
If I were to debug this I'd think the error is in the
if(y <= (Graphics::Screenheight - Groundheight - 400)
I needed similar physics a week ago, I'll send them here:
Code: Select all
BallY = BallY + BallVY;
++BallVY;
if (BallY >= (gfx.ScreenHeight - 1 - BallHeight))
{
BallVY = 1;
SpaceBarWasPressed = false;
}
if (wnd.kbd.KeyIsPressed(VK_SPACE) && !SpaceBarWasPressed)
{
BallVY = BallVY - 20;
SpaceBarWasPressed = true;
}
if (BallY <= 0)
{
BallVY = 1;
}
BallX = ClampScreenX(BallX, BallWidth);
BallY = ClampScreenY(BallY, BallHeight);
Also, use { } with your if statement, although you're only executing one thing after the if statement. Because if one adds things one will often forget to add the parameters.
If I were to debug this I'd think the error is in the
if(y <= (Graphics::Screenheight - Groundheight - 400)
Last edited by Zedtho on March 1st, 2017, 7:29 pm, edited 1 time in total.
Re: Infinite jumping
I mean that the animation is executed properly, but when mario touches the ground it bounces back infinitely.
The line you pointed out is just supposed to set the height the guy jumps to..
The line you pointed out is just supposed to set the height the guy jumps to..
Re: Infinite jumping
I don't see Mario being pulled back to the ground with a y += 10; or something anywhere, so it might get stuck at it's maximum height. Sorry, but I can't say much with this little code shown.
I apologise for the mistake with the if statement, by the way. Kind of stupid of me, haha.
I apologise for the mistake with the if statement, by the way. Kind of stupid of me, haha.
Last edited by Zedtho on March 1st, 2017, 7:35 pm, edited 1 time in total.
Re: Infinite jumping
This code makes it fall if not touching the ground.Forgot to share it sorry.
- Attachments
-
- sdaw.JPG (14.02 KiB) Viewed 2300 times
Re: Infinite jumping
Hmm, I guess more experienced programmers should get a go at this, then.
If you could post the whole code to the forum (via github or by attaching file after having zipped it with the tool by Chili) I could probably figure it out, though.
If you could post the whole code to the forum (via github or by attaching file after having zipped it with the tool by Chili) I could probably figure it out, though.