-
Notifications
You must be signed in to change notification settings - Fork 2
Rebase the platformer demo agaist the new plugin #15
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
Conversation
func _init(): | ||
body_entered.connect(_on_body_entered) | ||
func _on_body_entered(something: Node2D): |
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.
No particular need to fix this but the animation triggers when the player first enters the box, even if that's from below. I would expect it to trigger only when the player actually stands on the platform. I think that would be hard to do currently.
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.
Indeed. It is hard to get the collision direction right now.
is_playing = true | ||
if (is_playing): | ||
move_with_player_buttons('player_1', 'platformer', delta) | ||
if ((((velocity).x) == 0) and (((velocity).y) == 0)): |
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.
Instead of writing this:
You could also write:
since this change:
endlessm/godot-block-coding@80a8fc2
However I think what you have here is clearer.
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.
Good point! I even thought getting the length of the vector. But, ya, get the logic simpler and clearer.
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.
LGTM. I pushed two additional tweaks. Feel free to merge if you think those are OK>
The Block Code plugin has been updated to newer one which is not backward compatible. So, update the Platformer accordingly.
Use Sprite2D as the frames holder and AnimationPlayer to play idle, walk_right, walk_left, jump_up and jump_down animations. Also, defined methods be_idle, walk_right, walk_left, jump_up and jump_down in the BlockCode of the AnimationPlayer. They can be invoked by the player's action.
Thanks to the new Block Coding plugin providing access the node's method feature. This commit uses it to play the AnimationPlayer's shake animation by invoking the the Block node's play_shake method of the AnimationPlayer node.
Play the hit animation of the AnimationPlayer node when reset the player.
Drop AnimatedSprite2D node from player scene. It was the reference of the new AnimationPlayer node.
Previously the RESET track also wobbled the platform. With this change, the RESET track restores the platform's position to (0, 0).
If the player does not move, then there is no need to check it is on the floor, nor velocity of y direction. Use the "else if" condition to avoid further check which improves performance.
5772f74
to
4971476
Compare
Thank you! The two commits inspire me another two new commits :) |
Fixed the conflict in project.godot, then merged. |
Rebase the platformer demo agaist the new plugin. Besides, the new plugin provides accessing the node's method defined in the block node. So, implement the float platform, too.
https://phabricator.endlessm.com/T35696