Movement is more correct now since it uses the System::motion to do it for the player, which will always keep all the things updated. I also put placeholder barrels for all the non-combatant entities in the map. Finally, it still has the backup bug and now won't close when you close the window.
This commit is contained in:
parent
14128ab10f
commit
4b18b21861
3 changed files with 24 additions and 13 deletions
16
gui.cpp
16
gui.cpp
|
@ -44,12 +44,14 @@ namespace gui {
|
|||
|
||||
void FSM::MOVING(Event ) {
|
||||
if($camera.play_move($rayview)) {
|
||||
|
||||
// really annoying but we have to figure out the motion factor then run the systems
|
||||
auto &level = $levels.current();
|
||||
auto player = level.world->get_the<Player>();
|
||||
auto& player = level.world->get_the<Player>();
|
||||
auto& player_position = level.world->get<Position>(player.entity);
|
||||
player_position.location.x = size_t($camera.targetX);
|
||||
player_position.location.y = size_t($camera.targetY);
|
||||
auto& motion = level.world->get<Motion>(player.entity);
|
||||
Point move_to{size_t($camera.targetX), size_t($camera.targetY)};
|
||||
motion.dx = move_to.x - player_position.location.x;
|
||||
motion.dy = move_to.y - player_position.location.y;
|
||||
|
||||
run_systems();
|
||||
|
||||
|
@ -90,11 +92,13 @@ namespace gui {
|
|||
case FU::ROTATE_LEFT:
|
||||
$camera.plan_rotate($rayview, 1);
|
||||
state(State::ROTATING);
|
||||
break;
|
||||
return; // get out early since can always rotate
|
||||
break; // need this?
|
||||
case FU::ROTATE_RIGHT:
|
||||
$camera.plan_rotate($rayview, -1);
|
||||
state(State::ROTATING);
|
||||
break;
|
||||
return; // get out early since can always rotate
|
||||
break; // need this?
|
||||
default:
|
||||
dbc::sentinel("unhandled event in IDLE");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue