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:
parent
25ad9b51f8
commit
a19bc47904
4 changed files with 12 additions and 6 deletions
|
@ -2,7 +2,7 @@
|
|||
#include <numbers>
|
||||
#include <cmath>
|
||||
|
||||
void CameraLOL::plan_move(Raycaster &rayview, int dir, bool strafe) {
|
||||
Point CameraLOL::plan_move(Raycaster &rayview, int dir, bool strafe) {
|
||||
t = 0.0;
|
||||
if(strafe) {
|
||||
targetX = rayview.$posX + int(-rayview.$dirY * 1.5 * dir);
|
||||
|
@ -11,6 +11,8 @@ void CameraLOL::plan_move(Raycaster &rayview, int dir, bool strafe) {
|
|||
targetX = rayview.$posX + int(rayview.$dirX * 1.5 * dir);
|
||||
targetY = rayview.$posY + int(rayview.$dirY * 1.5 * dir);
|
||||
}
|
||||
|
||||
return {size_t(targetX), size_t(targetY)};
|
||||
}
|
||||
|
||||
void CameraLOL::plan_rotate(Raycaster &rayview, int dir) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue