this-city/modules/this_city/player_body.cpp

27 lines
623 B
C++

#include "player_body.h"
#include "core/config/engine.h"
void PlayerBody::_bind_methods() {
BIND_PROPERTY(Variant::FLOAT, movement_speed);
BIND_PROPERTY(Variant::FLOAT, jump_force);
BIND_PROPERTY(Variant::FLOAT, gravity);
}
void PlayerBody::_notification(int what) {
if (Engine::get_singleton()->is_editor_hint()) {
return;
}
switch (what) {
default:
return;
case NOTIFICATION_READY:
set_physics_process(true);
set_process_unhandled_input(true);
return;
case NOTIFICATION_PHYSICS_PROCESS:
process_movement();
return;
}
}
void PlayerBody::unhandled_input(Ref<InputEvent> const &event) {}