Skip to content

Conversation

starnight
Copy link
Contributor

@starnight starnight commented Oct 23, 2024

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

@starnight starnight requested a review from manuq October 23, 2024 07:35
func _init():
body_entered.connect(_on_body_entered)
func _on_body_entered(something: Node2D):
Copy link
Member

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.

Copy link
Contributor Author

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)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of writing this:

if x of velocity == 0 and y of velocity == 0

You could also write:

if not velocity

since this change:

endlessm/godot-block-coding@80a8fc2

However I think what you have here is clearer.

Copy link
Contributor Author

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.

Copy link
Member

@wjt wjt left a 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>

starnight and others added 9 commits October 25, 2024 13:36
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.
@starnight
Copy link
Contributor Author

LGTM. I pushed two additional tweaks. Feel free to merge if you think those are OK>

Thank you! The two commits inspire me another two new commits :)

@starnight starnight merged commit 9458b7c into godotcon Oct 25, 2024
@starnight starnight deleted the sync-block-coding branch October 25, 2024 06:18
@starnight
Copy link
Contributor Author

Fixed the conflict in project.godot, then merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants