-
Notifications
You must be signed in to change notification settings - Fork 270
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
Feature/demo platformer 2d #58
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review on a handful of points. I don't know if you changed some code already but looking at it, some doesn't look like code from the official demos.
I don't think a lost/win overlay is necessary. Having just one level with the playground is enough. The goal of these demos isn't to have full games I think, but to show how a feature works, or how to implement a mechanic, or in this case the core loop of a specific type of game. Doing more will make the demos overlap and use a lot more production + maintenance time.
General notes:
- We get most nodes using the
onready
keyword. The goal is to have all dependencies at the top of the scripts. - You don't need casting that way
- Avoid shorthands in variable names, e.g. favor
animation
overanim
The issue was that the floor's velocity (platform here) is only transfered to the character if move_and_slide_with_snap's stop_on_slope argument is `false`. stop_on_slope seems to stop the character's movement if it has no horizontal velocity and the floor's normal is < a threshold angle to the floor_normal parameter, even if it's horizontal in our case. To preserve stop_on_slope on slopes, I've introduced a Raycast2D that only detects platforms.
Just fixed the moving platform issue. Here's the explanation:
|
Regarding the code style/guidelines, would you like me to do e.g. part of a script, or part of the project to give you a headstart + example? The code has some no-nos to me at this point. |
Thanks for that Nathan. There are some parts of the code that are left over from the original demo that I haven't touched yet. I was planning on going over the scripts in more detail after everything was working using the guidelines but an example would be helpful if you have time. |
There you go, I just rewrote the code for the Player script. Regarding moving platforms, I'd also remove the code to use an animation player too, as that way, you can directly move the platforms in the editor and even use the new animation autokey feature to make the platforms move exactly where you want. |
That's great thanks for that! I'll work on the rest of the scenes today. |
The other scenes should be better now and I've tidied up the stage. I wanted to use Path2D for the moving platforms as I thought moving the path in the editor would make intuitive sense but the paths stop working when the KinematicBody2D is set to |
- Directly connect signals to target methods when possible - Improve coin animations so the audio can't trigger twice in the editor and so the coins' properties are reset every time you start the game
I just tweaked some tweaks. It's looking great to me! Do you still want to change anything or is it good to merge? |
Great! If you're happy with everything then it's all good! |
Hello!
I'm in the middle of refactoring the platformer demo. You can see a todo list and progress in #57
I'd like some advice on some things before cracking on again.
sync_to_physics
seems to be necessary but it's not usable withmove_and_slide
so I'm unsure how to do this properly.Please also offer any other feedback. This is also a learning experience for me as I learn to stick to the guidelines 😄
Cheers!