-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smooth Movement #101
base: main
Are you sure you want to change the base?
Smooth Movement #101
Conversation
Whoever you are, I just want to thank you as a CSSE 2 student this year for writing this movement logic. Wish I could say more, but thank you :) Have a great day :D |
No problem, I honestly didn't get to finish some of the collision to make it completely work. If you need any help with it I'll be here. Have a better day :D |
In the code for playerBase.js, look for case 'jump', and look for the line of code that specifies " this.yv = this.bottom * -0.04; " this line is in charge of gravity. if the number is closer to zero the gravity decreases, and farther away from zero the gravity increases. (the number has to be negative, otherwise he'll jump into the ground.) This would be good to change for a level with a different gravity than normal.
In the code for character.js, look for updateY under YCol, and look for the line that specifies " this.yv += GameEnv.gravity; " this line is in charge of the speed of the fall increasing as the character falls.
Each level has custom player controls, so for each level, I had to incorporate the new movement into every single file. This includes updating the
jumpHeightFactor
by dividing it by 10 so that when bouncing on the goombas the player doesn't shoot up. The code works but needs to be improved with collisions but the collision will deal with it and fix the issue. Besides that there is very rudimentary collision code that barely works but can stand by itself if the collison team doesn't figure out a solution to that issue.