Scarfy's Evil Twin (Scarfy refactored)

Original from ( C++ Fundamentals: Game Programming For Beginners )

2 Likes

Wow this is incredible!! :fire:

1 Like

Great job!

1 Like

Cool Scarfy mod.

Has anyone else noticed that sometimes Scarfy goes a few pixels lower after jumping? He’s not always on the ground. Before the double jump was removed from this project you could make the rectangle go very high and it had enough force it could be driven all the way below the window.

1 Like

I think is due to the delta time.

If we run game in my case the start of β€œy” position is 472
image
when i hit jump and landing on the groud:
image

So to fix that we can simple use:

// jumping pos
        if (velocity == 0)
        {
            scarfyData.pos.y = windowDemensions[1] - scarfyData.rec.height;
        }
        else
        {
            scarfyData.pos.y += velocity * dt;
        }
1 Like

Privacy & Terms