4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "gettext.hpp"
27 #include "sprite/sprite_manager.hpp"
28 #include "audio/sound_manager.hpp"
31 #include "sprite/sprite.hpp"
33 #include "resources.hpp"
34 #include "statistics.hpp"
35 #include "game_session.hpp"
36 #include "object/tilemap.hpp"
37 #include "object/camera.hpp"
38 #include "object/particles.hpp"
39 #include "object/portable.hpp"
40 #include "object/bullet.hpp"
41 #include "trigger/trigger_base.hpp"
42 #include "control/joystickkeyboardcontroller.hpp"
43 #include "scripting/squirrel_util.hpp"
45 #include "platform.hpp"
46 #include "badguy/badguy.hpp"
47 #include "player_status.hpp"
49 #include "falling_coin.hpp"
50 #include "random_generator.hpp"
52 static const int TILES_FOR_BUTTJUMP = 3;
53 static const float SHOOTING_TIME = .150;
54 /// time before idle animation starts
55 static const float IDLE_TIME = 2.5;
57 static const float WALK_ACCELERATION_X = 300;
58 static const float RUN_ACCELERATION_X = 400;
59 static const float SKID_XM = 200;
60 static const float SKID_TIME = .3;
61 static const float MAX_WALK_XM = 230;
62 static const float MAX_RUN_XM = 320;
63 static const float WALK_SPEED = 100;
65 static const float KICK_TIME = .3;
68 Surface* growingtux_left[GROWING_FRAMES];
69 Surface* growingtux_right[GROWING_FRAMES];
71 Surface* tux_life = 0;
73 TuxBodyParts* small_tux = 0;
74 TuxBodyParts* big_tux = 0;
75 TuxBodyParts* fire_tux = 0;
76 TuxBodyParts* ice_tux = 0;
79 TuxBodyParts::set_action(std::string action, int loops)
82 head->set_action(action, loops);
84 body->set_action(action, loops);
86 arms->set_action(action, loops);
88 feet->set_action(action, loops);
92 TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer)
95 head->draw(context, pos, layer-1);
97 body->draw(context, pos, layer-3);
99 arms->draw(context, pos, layer+10);
101 feet->draw(context, pos, layer-2);
104 Player::Player(PlayerStatus* _player_status)
105 : player_status(_player_status), grabbed_object(NULL)
107 controller = main_controller;
108 smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite");
109 smalltux_star = sprite_manager->create("images/creatures/tux_small/smalltux-star.sprite");
110 bigtux_star = sprite_manager->create("images/creatures/tux_big/bigtux-star.sprite");
112 sound_manager->preload("sounds/bigjump.wav");
113 sound_manager->preload("sounds/jump.wav");
114 sound_manager->preload("sounds/hurt.wav");
115 sound_manager->preload("sounds/skid.wav");
122 delete smalltux_gameover;
123 delete smalltux_star;
131 bbox.set_size(31.8, 62.8);
133 bbox.set_size(31.8, 30.8);
143 fall_mode = ON_GROUND;
148 backflipping = false;
149 backflip_direction = 0;
152 on_ground_flag = false;
153 grabbed_object = NULL;
155 floor_normal = Vector(0,-1);
161 Player::expose(HSQUIRRELVM vm, SQInteger table_idx)
163 Scripting::Player* interface = static_cast<Scripting::Player*> (this);
164 Scripting::expose_object(vm, table_idx, interface, "Tux", false);
168 Player::unexpose(HSQUIRRELVM vm, SQInteger table_idx)
170 Scripting::unexpose_object(vm, table_idx, "Tux");
174 Player::set_controller(Controller* controller)
176 this->controller = controller;
180 Player::update(float elapsed_time)
182 if(dying && dying_timer.check()) {
187 if(adjust_height != 0) {
188 bbox.move(Vector(0, bbox.get_height() - adjust_height));
189 bbox.set_height(adjust_height);
193 if(!dying && !deactivated)
196 movement = physic.get_movement(elapsed_time);
198 if(grabbed_object != NULL && !dying) {
199 Vector pos = get_pos() +
200 Vector(dir == LEFT ? -16 : 16,
201 bbox.get_height()*0.66666 - 32);
202 grabbed_object->grab(*this, pos, dir);
205 if(grabbed_object != NULL && dying){
206 grabbed_object->ungrab(*this, dir);
207 grabbed_object = NULL;
210 on_ground_flag = false;
216 return on_ground_flag;
222 if(player_status->bonus == NO_BONUS)
229 Player::handle_horizontal_input()
231 float vx = physic.get_velocity_x();
232 float vy = physic.get_velocity_y();
233 float ax = physic.get_acceleration_x();
234 float ay = physic.get_acceleration_y();
237 if(!duck || physic.get_velocity_y() != 0) {
238 if(controller->hold(Controller::LEFT) && !controller->hold(Controller::RIGHT)) {
242 } else if(!controller->hold(Controller::LEFT)
243 && controller->hold(Controller::RIGHT)) {
250 if (!controller->hold(Controller::ACTION)) {
251 ax = dirsign * WALK_ACCELERATION_X;
253 if(vx >= MAX_WALK_XM && dirsign > 0) {
256 } else if(vx <= -MAX_WALK_XM && dirsign < 0) {
261 ax = dirsign * RUN_ACCELERATION_X;
263 if(vx >= MAX_RUN_XM && dirsign > 0) {
266 } else if(vx <= -MAX_RUN_XM && dirsign < 0) {
272 // we can reach WALK_SPEED without any acceleration
273 if(dirsign != 0 && fabs(vx) < WALK_SPEED) {
274 vx = dirsign * WALK_SPEED;
277 // changing directions?
278 if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) {
280 if(fabs(vx)>SKID_XM && !skidding_timer.started()) {
281 skidding_timer.start(SKID_TIME);
282 sound_manager->play("sounds/skid.wav");
283 // dust some particles
284 Sector::current()->add_object(
286 Vector(dir == RIGHT ? bbox.p2.x : bbox.p1.x, bbox.p2.y),
287 dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20,
288 Vector(280, -260), Vector(0, 300), 3, Color(.4, .4, .4), 3, .8,
297 // we get slower when not pressing any keys
299 if(fabs(vx) < WALK_SPEED) {
303 ax = WALK_ACCELERATION_X * 1.5;
305 ax = WALK_ACCELERATION_X * -1.5;
310 // if we're on ice slow down acceleration or deceleration
311 if (isice(base.x, base.y + base.height))
313 /* the acceleration/deceleration rate on ice is inversely proportional to
314 * the current velocity.
317 // increasing 1 will increase acceleration/deceleration rate
318 // decreasing 1 will decrease acceleration/deceleration rate
319 // must stay above zero, though
320 if (ax != 0) ax *= 1 / fabs(vx);
324 // extend/shrink tux collision rectangle so that we fall through/walk over 1
326 if(fabsf(vx) > MAX_WALK_XM) {
329 bbox.set_width(31.8);
332 // on downward slopes, adjust vertical velocity to match slope angle
334 if (floor_normal.y != 0) {
335 if ((floor_normal.x * vx) > 0) {
336 // we overdo it a little, just to be on the safe side
337 vy = vx * (floor_normal.x / floor_normal.y) * 2;
342 physic.set_velocity(vx, vy);
343 physic.set_acceleration(ax, ay);
347 Player::handle_vertical_input()
351 fall_mode = ON_GROUND;
352 last_ground_y = get_pos().y;
354 if(get_pos().y > last_ground_y)
356 else if(fall_mode == ON_GROUND)
360 if(on_ground()) { /* Make sure jumping is off. */
363 backflipping = false;
364 backflip_direction = 0;
369 if(controller->pressed(Controller::JUMP) && can_jump && on_ground()) {
371 if (physic.get_velocity_x() != 0) // only jump a little bit when running ducked
372 physic.set_velocity_y(300);
373 else { //do a backflip
375 physic.set_velocity_y(580);
376 backflip_timer.start(0.15);
379 else if (fabs(physic.get_velocity_x()) > MAX_WALK_XM) // jump higher if we are running
380 physic.set_velocity_y(580);
382 physic.set_velocity_y(520);
384 //bbox.move(Vector(0, -1));
388 sound_manager->play("sounds/bigjump.wav");
390 sound_manager->play("sounds/jump.wav");
391 } else if(!controller->hold(Controller::JUMP)) { // Let go of jump key
392 if (!backflipping && jumping && physic.get_velocity_y() > 0) {
394 physic.set_velocity_y(0);
398 /* In case the player has pressed Down while in a certain range of air,
399 enable butt jump action */
400 if (controller->hold(Controller::DOWN) && !butt_jump && !duck)
401 //if(tiles_on_air(TILES_FOR_BUTTJUMP) && jumping)
404 /* When Down is not held anymore, disable butt jump */
405 if(butt_jump && !controller->hold(Controller::DOWN))
410 if (butt_jump && on_ground() && is_big()) {
413 Sector::current()->add_smoke_cloud(Vector(get_pos().x - 32, get_pos().y));
415 Sector::current()->add_smoke_cloud(
416 Vector(get_pos().x - 32, get_pos().y + 32));
420 // Break bricks beneath Tux
421 if(Sector::current()->trybreakbrick(
422 Vector(base.x + 1, base.y + base.height), false)
423 || Sector::current()->trybreakbrick(
424 Vector(base.x + base.width - 1, base.y + base.height), false)) {
425 physic.set_velocity_y(2);
429 // Kill nearby badguys
430 std::vector<GameObject*> gameobjects = Sector::current()->gameobjects;
431 for (std::vector<GameObject*>::iterator i = gameobjects.begin();
432 i != gameobjects.end();
434 BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
436 // don't kill when badguys are already dying or in a certain mode
437 if(badguy->dying == DYING_NOT && badguy->mode != BadGuy::BOMB_TICKING &&
438 badguy->mode != BadGuy::BOMB_EXPLODE) {
439 if (fabsf(base.x - badguy->base.x) < 96 &&
440 fabsf(base.y - badguy->base.y) < 64)
448 /** jumping is only allowed if we're about to touch ground soon and if the
449 * button has been up in between the last jump
453 if ( (issolid(get_pos().x + bbox.get_width() / 2,
454 get_pos().y + bbox.get_height() + 64) ||
455 issolid(get_pos().x + 1, get_pos().y + bbox.get_height() + 64) ||
456 issolid(get_pos().x + bbox.get_width() - 1,
457 get_pos().y + bbox.get_height() + 64))
460 && input.jump && !input.old_jump)
468 Player::handle_input()
470 if(!controller->hold(Controller::ACTION) && grabbed_object) {
471 // move the grabbed object a bit away from tux
472 Vector pos = get_pos() +
473 Vector(dir == LEFT ? -bbox.get_width()-1 : bbox.get_width()+1,
474 bbox.get_height()*0.66666 - 32);
475 Rect dest(pos, pos + Vector(32, 32));
476 if(Sector::current()->is_free_space(dest)) {
477 MovingObject* moving_object = dynamic_cast<MovingObject*> (grabbed_object);
479 moving_object->set_pos(pos);
481 log_debug << "Non MovingObjetc grabbed?!?" << std::endl;
483 grabbed_object->ungrab(*this, dir);
484 grabbed_object = NULL;
488 /* Handle horizontal movement: */
489 if (!backflipping) handle_horizontal_input();
491 if (backflip_direction == 0) {
492 dir == LEFT ? backflip_direction = 1 : backflip_direction = -1;
494 else backflip_direction == 1 ? dir = LEFT : dir = RIGHT; //prevent player from changing direction when backflipping
495 if (backflip_timer.check()) physic.set_velocity_x(100 * backflip_direction);
500 if (on_ground() && !controller->hold(Controller::JUMP))
502 handle_vertical_input();
505 if (controller->pressed(Controller::ACTION) && player_status->bonus == FIRE_BONUS) {
506 if(Sector::current()->add_bullet(
507 get_pos() + ((dir == LEFT)? Vector(0, bbox.get_height()/2)
508 : Vector(32, bbox.get_height()/2)),
509 physic.get_velocity_x(), dir))
510 shooting_timer.start(SHOOTING_TIME);
514 if (controller->hold(Controller::DOWN) && is_big() && !duck
515 && physic.get_velocity_y() == 0 && on_ground()) {
517 bbox.move(Vector(0, 32));
518 bbox.set_height(31.8);
519 } else if(!controller->hold(Controller::DOWN) && is_big() && duck) {
520 // if we have some velocity left then check if there is space for
522 bbox.move(Vector(0, -32));
523 bbox.set_height(63.8);
524 if(Sector::current()->is_free_space(bbox) || (
525 physic.get_velocity_x() > -.01 && physic.get_velocity_x() < .01
526 && physic.get_velocity_y() > -.01 && physic.get_velocity_y() < .01))
530 // undo the ducking changes
531 bbox.move(Vector(0, 32));
532 bbox.set_height(31.8);
538 Player::add_coins(int count)
540 player_status->add_coins(count);
544 Player::add_bonus(const std::string& bonustype)
546 if(bonustype == "grow") {
547 add_bonus(GROWUP_BONUS);
548 } else if(bonustype == "fireflower") {
549 add_bonus(FIRE_BONUS);
550 } else if(bonustype == "iceflower") {
551 add_bonus(ICE_BONUS);
552 } else if(bonustype == "none") {
555 std::ostringstream msg;
556 msg << "Unknown bonus type " << bonustype;
557 throw std::runtime_error(msg.str());
562 Player::add_bonus(BonusType type, bool animate)
564 // always ignore NO_BONUS
565 if (type == NO_BONUS) {
569 // ignore GROWUP_BONUS if we're already big
570 if (type == GROWUP_BONUS) {
571 if (player_status->bonus == GROWUP_BONUS) return;
572 if (player_status->bonus == FIRE_BONUS) return;
573 if (player_status->bonus == ICE_BONUS) return;
576 set_bonus(type, animate);
580 Player::set_bonus(BonusType type, bool animate)
582 if(player_status->bonus == NO_BONUS) {
583 adjust_height = 62.8;
585 growing_timer.start(GROWING_TIME);
588 if ((type == NO_BONUS) || (type == GROWUP_BONUS)) {
589 player_status->max_fire_bullets = 0;
590 player_status->max_ice_bullets = 0;
592 if (type == FIRE_BONUS) player_status->max_fire_bullets++;
593 if (type == ICE_BONUS) player_status->max_ice_bullets++;
595 player_status->bonus = type;
599 Player::set_visible(bool visible)
601 this->visible = visible;
605 Player::get_visible()
613 kick_timer.start(KICK_TIME);
617 Player::draw(DrawingContext& context)
622 TuxBodyParts* tux_body;
624 if (player_status->bonus == GROWUP_BONUS)
626 else if (player_status->bonus == FIRE_BONUS)
628 else if (player_status->bonus == ICE_BONUS)
631 tux_body = small_tux;
633 int layer = LAYER_OBJECTS + 1;
635 /* Set Tux sprite action */
636 if (duck && is_big())
639 tux_body->set_action("duck-left");
641 tux_body->set_action("duck-right");
643 else if (skidding_timer.started() && !skidding_timer.check())
646 tux_body->set_action("skid-left");
648 tux_body->set_action("skid-right");
650 else if (kick_timer.started() && !kick_timer.check())
653 tux_body->set_action("kick-left");
655 tux_body->set_action("kick-right");
657 else if (butt_jump && is_big())
660 tux_body->set_action("buttjump-left");
662 tux_body->set_action("buttjump-right");
664 else if (!on_ground())
667 tux_body->set_action("jump-left");
669 tux_body->set_action("jump-right");
673 if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
676 tux_body->set_action("stand-left");
678 tux_body->set_action("stand-right");
683 tux_body->set_action("walk-left");
685 tux_body->set_action("walk-right");
689 if(idle_timer.check())
694 tux_body->head->set_action("idle-left", 1);
696 tux_body->head->set_action("idle-right", 1);
701 // Tux is holding something
702 if ((grabbed_object != 0 && physic.get_velocity_y() == 0) ||
703 (shooting_timer.get_timeleft() > 0 && !shooting_timer.check()))
708 tux_body->arms->set_action("duck+grab-left");
710 tux_body->arms->set_action("duck+grab-right");
715 tux_body->arms->set_action("grab-left");
717 tux_body->arms->set_action("grab-right");
723 smalltux_gameover->draw(context, get_pos(), LAYER_FLOATINGOBJECTS + 1);
724 } else if(growing_timer.get_timeleft() > 0) {
726 context.draw_surface(growingtux_right[int((growing_timer.get_timegone() *
727 GROWING_FRAMES) / GROWING_TIME)], get_pos() - Vector(0, 32), layer);
729 context.draw_surface(growingtux_left[int((growing_timer.get_timegone() *
730 GROWING_FRAMES) / GROWING_TIME)], get_pos() - Vector(0, 32), layer);
733 else if (safe_timer.started() && size_t(game_time*40)%2)
736 tux_body->draw(context, get_pos(), layer);
738 // Draw blinking star overlay
739 if (invincible_timer.started() &&
740 (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING
741 || size_t(game_time*20)%2)
744 if (!is_big() || duck)
745 smalltux_star->draw(context, get_pos(), layer + 5);
747 bigtux_star->draw(context, get_pos(), layer + 5);
752 Player::collision_tile(uint32_t tile_attributes)
754 if(tile_attributes & Tile::HURTS)
759 Player::collision(GameObject& other, const CollisionHit& hit)
761 Bullet* bullet = dynamic_cast<Bullet*> (&other);
766 if(other.get_flags() & FLAG_PORTABLE) {
767 Portable* portable = dynamic_cast<Portable*> (&other);
768 assert(portable != NULL);
769 if(portable && grabbed_object == NULL
770 && controller->hold(Controller::ACTION)
771 && fabsf(hit.normal.x) > .9) {
772 grabbed_object = portable;
773 grabbed_object->grab(*this, get_pos(), dir);
778 if(other.get_flags() & FLAG_SOLID) {
780 printf("Col %p: HN: %3.1f %3.1f D %.1f P: %3.1f %3.1f M: %3.1f %3.1f\n",
782 hit.normal.x, hit.normal.y, hit.depth,
783 get_pos().x, get_pos().y,
784 movement.x, movement.y);
787 if(hit.normal.y < 0) { // landed on floor?
788 if(physic.get_velocity_y() < 0)
789 physic.set_velocity_y(0);
791 on_ground_flag = true;
793 // remember normal of this tile
794 if (hit.normal.y > -0.9) {
795 floor_normal.x = hit.normal.x;
796 floor_normal.y = hit.normal.y;
798 // slowly adjust to unisolid tiles.
799 // Necessary because our bounding box sometimes reaches through slopes and thus hits unisolid tiles
800 floor_normal.x = (floor_normal.x * 0.9) + (hit.normal.x * 0.1);
801 floor_normal.y = (floor_normal.y * 0.9) + (hit.normal.y * 0.1);
804 // hack platforms so that we stand normally on them when going down...
805 Platform* platform = dynamic_cast<Platform*> (&other);
806 if(platform != NULL) {
807 if(platform->get_speed().y > 0)
808 physic.set_velocity_y(-platform->get_speed().y);
809 //physic.set_velocity_x(platform->get_speed().x);
811 } else if(hit.normal.y > 0) { // bumped against the roof
812 physic.set_velocity_y(.1);
814 // hack platform so that we are not glued to it from below
815 Platform* platform = dynamic_cast<Platform*> (&other);
816 if(platform != NULL) {
817 physic.set_velocity_y(-platform->get_speed().y);
821 if(fabsf(hit.normal.x) > .9) { // hit on the side?
822 physic.set_velocity_x(0);
825 MovingObject* omov = dynamic_cast<MovingObject*> (&other);
827 Vector mov = movement - omov->get_movement();
829 printf("W %p - HITN: %3.1f %3.1f D:%3.1f TM: %3.1f %3.1f TD: %3.1f %3.1f PM: %3.2f %3.1f\n",
831 hit.normal.x, hit.normal.y,
833 movement.x, movement.y,
834 dest.p1.x, dest.p1.y,
835 omov->get_movement().x, omov->get_movement().y);
843 assert(dynamic_cast<MovingObject*> (&other) != NULL);
845 MovingObject* moving_object = static_cast<MovingObject*> (&other);
846 if(moving_object->get_group() == COLGROUP_TOUCHABLE) {
847 TriggerBase* trigger = dynamic_cast<TriggerBase*> (&other);
849 if(controller->pressed(Controller::UP))
850 trigger->event(*this, TriggerBase::EVENT_ACTIVATE);
856 BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
858 if(safe_timer.started())
868 Player::make_invincible()
870 sound_manager->play("sounds/invincible.wav");
871 invincible_timer.start(TUX_INVINCIBLE_TIME);
872 Sector::current()->play_music(HERRING_MUSIC);
877 Player::kill(bool completely)
879 if(dying || deactivated)
883 (safe_timer.get_timeleft() > 0 || invincible_timer.get_timeleft() > 0))
886 sound_manager->play("sounds/hurt.wav");
888 physic.set_velocity_x(0);
890 if(!completely && is_big()) {
891 if(player_status->bonus == FIRE_BONUS
892 || player_status->bonus == ICE_BONUS) {
893 safe_timer.start(TUX_SAFE_TIME);
894 set_bonus(GROWUP_BONUS);
896 //growing_timer.start(GROWING_TIME);
897 safe_timer.start(TUX_SAFE_TIME /* + GROWING_TIME */);
898 adjust_height = 30.8;
903 for (int i = 0; (i < 5) && (i < player_status->coins); i++)
905 // the numbers: starting x, starting y, velocity y
906 Sector::current()->add_object(new FallingCoin(get_pos() +
907 Vector(systemRandom.rand(5), systemRandom.rand(-32,18)),
908 systemRandom.rand(-100,100)));
910 physic.enable_gravity(true);
911 physic.set_acceleration(0, 0);
912 physic.set_velocity(0, 700);
913 player_status->coins -= 25;
916 dying_timer.start(3.0);
917 set_group(COLGROUP_DISABLED);
919 DisplayEffect* effect = new DisplayEffect();
920 effect->fade_out(3.0);
921 Sector::current()->add_object(effect);
922 sound_manager->stop_music(3.0);
927 Player::move(const Vector& vector)
929 bbox.set_pos(vector);
931 bbox.set_size(31.8, 63.8);
933 bbox.set_size(31.8, 31.8);
935 last_ground_y = vector.y;
941 Player::check_bounds(Camera* camera)
943 /* Keep tux in bounds: */
944 if (get_pos().x < 0) {
945 // Lock Tux to the size of the level, so that he doesn't fall of
947 bbox.set_pos(Vector(0, get_pos().y));
950 /* Keep in-bounds, vertically: */
951 if (get_pos().y > Sector::current()->solids->get_height() * 32) {
957 // can happen if back scrolling is disabled
958 if(get_pos().x < camera->get_translation().x) {
959 bbox.set_pos(Vector(camera->get_translation().x, get_pos().y));
962 if(get_pos().x >= camera->get_translation().x + SCREEN_WIDTH - bbox.get_width())
965 camera->get_translation().x + SCREEN_WIDTH - bbox.get_width(),
974 if(collision_object_map(bbox)) {
983 Player::add_velocity(const Vector& velocity)
985 physic.set_velocity(physic.get_velocity() + velocity);
989 Player::bounce(BadGuy& )
991 if(controller->hold(Controller::JUMP))
992 physic.set_velocity_y(520);
994 physic.set_velocity_y(300);
997 //Scripting Functions Below
1000 Player::deactivate()
1003 physic.set_velocity_x(0);
1004 physic.set_velocity_y(0);
1005 physic.set_acceleration_x(0);
1006 physic.set_acceleration_y(0);
1012 deactivated = false;
1015 void Player::walk(float speed)
1017 physic.set_velocity_x(speed);