Did a version of the raycaster that uses a pixel buffer sent to a texture that goes to a sprite that goes on a frog that's on a log on the bottom of the ocean under a tortoise that's carrying a sack that has the...
This commit is contained in:
parent
e8a32ba9f3
commit
d5047c00e2
3 changed files with 245 additions and 2 deletions
|
@ -148,9 +148,9 @@ int main() {
|
|||
float x = player_x;
|
||||
float y = player_y;
|
||||
|
||||
if(KB::isKeyPressed(KB::A)) {
|
||||
if(KB::isKeyPressed(KB::Q)) {
|
||||
player_angle -= 0.1;
|
||||
} else if(KB::isKeyPressed(KB::D)) {
|
||||
} else if(KB::isKeyPressed(KB::E)) {
|
||||
player_angle += 0.1;
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,14 @@ int main() {
|
|||
y -= std::cos(player_angle) * 5;
|
||||
}
|
||||
|
||||
if(KB::isKeyPressed(KB::D)) {
|
||||
x += -1 * std::sin(player_angle + std::numbers::pi * 0.5) * 5;
|
||||
y += std::cos(player_angle + std::numbers::pi * 0.5) * 5;
|
||||
} else if(KB::isKeyPressed(KB::A)) {
|
||||
x -= -1 * std::sin(player_angle + std::numbers::pi * 0.5) * 5;
|
||||
y -= std::cos(player_angle + std::numbers::pi * 0.5) * 5;
|
||||
}
|
||||
|
||||
if(!collision(x, y)) {
|
||||
player_x = x;
|
||||
player_y = y;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue