+ }
+ }
+
+ /* Turn to Stone */
+ if (controller->pressed(Controller::DOWN) && player_status->bonus == EARTH_BONUS && !cooldown_timer.started()) {
+ if (controller->hold(Controller::ACTION) && !ability_timer.started()) {
+ ability_timer.start(player_status->max_earth_time * STONE_TIME_PER_FLOWER);
+ powersprite->stop_animation();
+ stone = true;
+ physic.set_gravity_modifier(1.0f); // Undo jump_early_apex
+ }
+ }
+
+ if (stone)
+ apply_friction();
+
+ /* Revert from Stone */
+ if (stone && (!controller->hold(Controller::ACTION) || ability_timer.get_timeleft() <= 0.5f)) {
+ cooldown_timer.start(ability_timer.get_timegone()/2.0f); //The longer stone form is used, the longer until it can be used again
+ ability_timer.stop();
+ sprite->set_angle(0.0f);
+ powersprite->set_angle(0.0f);
+ lightsprite->set_angle(0.0f);
+ stone = false;
+ for (int i = 0; i < 8; i++)
+ {
+ Vector ppos = Vector(get_bbox().get_left() + 8 + 16*((int)i/4), get_bbox().get_top() + 16*(i%4));
+ float grey = graphicsRandom.randf(.4f, .8f);
+ Color pcolor = Color(grey, grey, grey);
+ Sector::current()->add_object(std::make_shared<Particles>(ppos, -60, 240, 42, 81, Vector(0, 500),
+ 8, pcolor, 4 + graphicsRandom.randf(-0.4, 0.4),
+ 0.8 + graphicsRandom.randf(0, 0.4), LAYER_OBJECTS+2));
+ }