#include "object/bullet.hpp"
#include "trigger/trigger_base.hpp"
#include "control/joystickkeyboardcontroller.hpp"
+#include "scripting/wrapper_util.hpp"
#include "main.hpp"
#include "platform.hpp"
#include "badguy/badguy.hpp"
smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite");
smalltux_star = sprite_manager->create("images/creatures/tux_small/smalltux-star.sprite");
bigtux_star = sprite_manager->create("images/creatures/tux_big/bigtux-star.sprite");
+
init();
}
Player::init()
{
if(is_big())
- bbox.set_size(31.8, 63.8);
+ bbox.set_size(31.8, 62.8);
else
- bbox.set_size(31.8, 31.8);
+ bbox.set_size(31.8, 30.8);
adjust_height = 0;
dir = RIGHT;
}
void
+Player::expose(HSQUIRRELVM vm, int table_idx)
+{
+ Scripting::Player* interface = static_cast<Scripting::Player*> (this);
+ expose_object(vm, table_idx, interface, "Tux", false);
+}
+
+void
+Player::unexpose(HSQUIRRELVM vm, int table_idx)
+{
+ Scripting::unexpose_object(vm, table_idx, "Tux");
+}
+
+void
Player::set_controller(Controller* controller)
{
this->controller = controller;
if(moving_object) {
moving_object->set_pos(pos);
} else {
- msg_debug("Non MovingObjetc grabbed?!?");
+ msg_debug << "Non MovingObjetc grabbed?!?" << std::endl;
}
grabbed_object->ungrab(*this, dir);
grabbed_object = 0;
return;
if(player_status->bonus == NO_BONUS) {
- adjust_height = 63.8;
+ adjust_height = 62.8;
if(animate)
growing_timer.start(GROWING_TIME);
}
{
if(!visible)
return;
-
+
TuxBodyParts* tux_body;
if (player_status->bonus == GROWUP_BONUS)
else // dir == RIGHT
tux_body->set_action("buttjump-right");
}
- else if (physic.get_velocity_y() != 0 && !on_ground())
+ else if (!on_ground())
{
if(dir == LEFT)
tux_body->set_action("jump-left");
}
if(other.get_flags() & FLAG_SOLID) {
+ /*
+ printf("Col %p: HN: %3.1f %3.1f D %.1f P: %3.1f %3.1f M: %3.1f %3.1f\n",
+ &other,
+ hit.normal.x, hit.normal.y, hit.depth,
+ get_pos().x, get_pos().y,
+ movement.x, movement.y);
+ */
+
if(hit.normal.y < 0) { // landed on floor?
if(physic.get_velocity_y() < 0)
physic.set_velocity_y(0);
{
//growing_timer.start(GROWING_TIME);
safe_timer.start(TUX_SAFE_TIME /* + GROWING_TIME */);
- adjust_height = 31.8;
+ adjust_height = 30.8;
duck = false;
player_status->bonus = NO_BONUS;
}
physic.enable_gravity(true);
physic.set_acceleration(0, 0);
physic.set_velocity(0, 700);
- player_status->lives -= 1;
+ player_status->coins -= 25;
player_status->bonus = NO_BONUS;
dying = true;
dying_timer.start(3.0);
{
physic.set_velocity_x(speed);
}
+