Closed johnnygossdev closed 5 years ago
Just fixed the moving platform issue. Here's the explanation:
The issue was that the floor's velocity (platform here) is only transferred 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.
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. There's more refactoring to do to show good practices: the physics layers and masks are a mess, so the original code relied on things like having the bullet get its parent and making it an exception for collisions. Anyway, the player is the most complicated bit here. from there, I think we could make some more gameplay improvements, but it'll be part of the polishing phase. I'd port all the code to fit the guidelines at this point.
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 sync_to_physics
so I used an AnimationPlayer instead. Still sad about that one.
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!