Skip to content
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

Added wall slide support #15

Merged
merged 9 commits into from
Sep 13, 2019
Merged

Added wall slide support #15

merged 9 commits into from
Sep 13, 2019

Conversation

paweljarosz
Copy link
Contributor

Added wall slide support.

Platypus, when config.allow_wall_slide is true, can now handle wall slide with a mutable config.wall_slide_gravity, which simulates sliding slowly down a wall. It notifies game object about starting wall slide with a message platypus.WALL_SLIDE and user can check if it is_wall_sliding(). Added this possibility to the example project. Fixed collision rays in example's config. Added abort_wall_slide() when control keys are released. Updated readme with new functionality informations and general double and wall jumps and wall slide.

…behavior allows to modify signicifantly the velocity during wall jump using left and right functions. New config key const_wall_jump is by default set to false, so it doesn't change the legacy, but when set to true by user, it blocks possibility to alter a jump after bouncing from a wall. Added new state - wall_jump and thus added a function to get that information from platypus.
…n now handle wall slide with a mutable wall_slide_gravity, which simulates sliding slowly down a wall. It notifies game object about starting wall slide and user can check if it is_wall_sliding(). Added this possibility to the example project. Fixed collision rays in example's config. Added abort_wall_slide() when control keys are released. Updated readme with new functionality.
Copy link
Owner

@britzl britzl left a comment

Choose a reason for hiding this comment

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

Looks good! Some formatting and grammar mainly.

@@ -108,6 +117,8 @@ Platypus will send messages for certain state changes so that scripts can react,
print("Doing a double jump!")
elseif message_id == platypus.JUMP then
print("Jumping!")
elseif message_id == platypus.WALL_SLIDE then
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation. Use tabs.

-- apply wall slide gravity
if state.current.wall_slide then
platypus.velocity.y = platypus.velocity.y + platypus.wall_slide_gravity * dt

Copy link
Owner

Choose a reason for hiding this comment

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

Remove extra line

@@ -324,6 +346,11 @@ function M.create(config)
elseif state.current.wall_contact and platypus.allow_wall_jump then
state.current.wall_jump = true
state.previous.wall_jump = true
-- abort wall sliding when jumping from wall
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe call platypus.abort_wall slide() instead? Or skip the conditional check and set current+previous wall_slide to false

README.md Outdated
@@ -79,6 +79,15 @@ Use `platypus.jump()` to perform a jump and `platypus.abort_jump()` to reduce th
end
end
end

## Double jump, wall jump and wall slide
Platypus supports double jumps when config.allow_double_jump is set to true. Then, it occurs automatically, when used jump() while already jumped up.
Copy link
Owner

Choose a reason for hiding this comment

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

Change second sentence to "A double jump is performed automatically when a second jump is done before and up until reaching the apex of the first jump. It is not possible to performa a double jump when falling"

README.md Outdated
## Double jump, wall jump and wall slide
Platypus supports double jumps when config.allow_double_jump is set to true. Then, it occurs automatically, when used jump() while already jumped up.

Platypus supports wall jumps when config.allow_wall_jump is set to true. Then, it occurs automatically, when used jump() while having a wall_contact.
Copy link
Owner

Choose a reason for hiding this comment

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

Change second sentence. "A wall jump is performed automatically when jumping while having wall contact while falling or wall sliding. The wall jump pushes the player out from the wall in question."

README.md Outdated
Platypus supports wall jumps when config.allow_wall_jump is set to true. Then, it occurs automatically, when used jump() while having a wall_contact.
Normally, user can alter your movement right after bounced from a wall, but when you set config.const_wall_jump - the bounce will be always the same and user won't be able to alter it.

Platypus supports wall slide when config.allow_wall_slide is set to true. Then, it occurs automatically, when pushing toward a wall, while falling down. Platypus offers also to abort_wall_slide(), for example, when the control key is released, so user is no longer pushing toward the wall.
Copy link
Owner

Choose a reason for hiding this comment

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

Change second sentence. "A wall slide will be performed automatically when the player has wall contact while falling and moving (using platypus.left() or platypus.right()) in the direction of the wall."

@paweljarosz
Copy link
Contributor Author

Thanks for the review! I'll push a commit probably this evening ;)

Copy link
Owner

@britzl britzl left a comment

Choose a reason for hiding this comment

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

Please review the comments on the documentation as well!

Copy link
Owner

@britzl britzl left a comment

Choose a reason for hiding this comment

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

You missed one indentation issue but that's ok. I'll fix it! Thank you for your contribution!

@britzl britzl merged commit e491267 into britzl:master Sep 13, 2019
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