Skip to content

Comments

Rocks can activate buttons#1354

Closed
weluvgoatz wants to merge 2 commits intoSuperTux:masterfrom
weluvgoatz:rocks-buttons
Closed

Rocks can activate buttons#1354
weluvgoatz wants to merge 2 commits intoSuperTux:masterfrom
weluvgoatz:rocks-buttons

Conversation

@weluvgoatz
Copy link
Member

This PR allows rocks to be thrown onto pushbuttons in order to activate them. While it seems this is an approved feature, I would like testing for it.

auto player = dynamic_cast<Player*>(&other);
if (!player) return FORCE_MOVE;
auto rock = dynamic_cast<Rock*>(&other);
if (!player && !rock) return FORCE_MOVE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a line break. (return jumps out of the function execution, so it should always stick out.)

Suggested change
if (!player && !rock) return FORCE_MOVE;
if (!player && !rock)
return FORCE_MOVE;


if (vy <= 0) return FORCE_MOVE;
//player->add_velocity(Vector(0, -150));
player->get_physic().set_velocity_y(-150);
Copy link
Contributor

@HybridDog HybridDog Mar 3, 2020

Choose a reason for hiding this comment

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

Could you fix the indentation and a line break to the return?

Comment on lines 75 to 76
if (state != OFF) return FORCE_MOVE;
if (!hit.top) return FORCE_MOVE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (state != OFF) return FORCE_MOVE;
if (!hit.top) return FORCE_MOVE;
if (state != OFF || !hit.top)
return FORCE_MOVE;

@weluvgoatz
Copy link
Member Author

Closing, due to lack of activity and lack of interest.

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.

3 participants