FINALLY fix that stupid bug. The cause was two-fold: I was giving every 'enemy' a sprite, but that automatically included the player in the list of enemies, which meant that I was rendering the player's sprite while moving. Then in the sprite casting loop I was rendering things at 0.

This commit is contained in:
Zed A. Shaw 2025-02-07 11:05:15 -05:00
parent 25ad9b51f8
commit a19bc47904
4 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,4 @@
#define FSM_DEBUG 1
#include "gui.hpp"
#include <iostream>
#include <chrono>
@ -96,9 +97,7 @@ namespace gui {
void FSM::try_move(int dir, bool strafe) {
// prevent moving into occupied space
$camera.plan_move($rayview, dir, strafe);
Point move_to{size_t($camera.targetX), size_t($camera.targetY)};
Point move_to = $camera.plan_move($rayview, dir, strafe);
if($level.map->can_move(move_to) && !$level.collision->occupied(move_to)) {
state(State::MOVING);
@ -221,8 +220,8 @@ namespace gui {
}
void FSM::run_systems() {
System::motion($level);
System::enemy_pathing($level);
System::motion($level);
System::collision($level);
System::death($level);
}