• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C++ Help on game Project


New Coder
So right now we're making a game, non of us besides one on our team is a programmer

But I want to help but i'm honestly not that good at programming and whatever I learned last year has been lost over quarantine. So currently we're creating a sliding puzzle game, you slide across ice hitting barriers to stop movement and then choosing the next direction. Question is right now is how to make the platforms that aren't ice walk-able? Any direction you walk you keep sliding even on the non-icy surfaces. So what would the code look like for Sliding & Non Sliding movement?

Krusty the Senile

Active Coder
I'm guessing your current code has something like "keep going in a given direction until the user input changes the direction or velocity". What you're going to want to do is "if on non-icy surface, reduce velocity until 0" This must be balanced out with the player's current input.
Depending on your development environment (Unity? Unreal Engine?) there will be a function that updates the character's position in fixed time intervals (like 20 times a second). This is where you would put this code.
It might help if you provided either code or a link to the code so I can see what's happening.
Top Bottom