This commit is contained in:
DarthMooMancer
2025-10-28 20:50:02 -04:00
parent 3740070c48
commit ea738bb4b5
6 changed files with 40 additions and 7 deletions
+18 -2
View File
@@ -1,11 +1,11 @@
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/Color.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <SFML/Window/Keyboard.hpp>
#include <SFML/Window/Mouse.hpp>
#include <cmath>
#include <cstdlib>
#include <string>
#include <thread>
@@ -30,7 +30,7 @@ int main() {
float max_velocity_y { 15.0f };
float border_size { -1.0f };
float dash_distance { 20.0f };
sf::Vector2f velocity { 4.0f, 0 };
sf::Vector2f velocity { 3.0f, 0 };
} player_data;
load_map(wall_list, test_level_0);
@@ -41,6 +41,14 @@ int main() {
player_data.dash_distance, sf::Color::Black, sf::Color::White
};
Entity enemy {
{ TILESIZE / 2.0f, TILESIZE / 2.0f },
{ TILESIZE * 5, TILESIZE * 3 },
{ 0, 0 },
-1.0f,
sf::Color::Red
};
sf::RenderWindow window(sf::VideoMode({WIDTH, HEIGHT}), "SFML window", sf::Style::Default);
window.setFramerateLimit(FPS);
@@ -55,6 +63,7 @@ int main() {
bool running = true;
std::thread player_dash_cooldown([&] { time.update_timers(running, player.timers); } );
// sf::View view1(sf::FloatRect({000.f, 000.f}, {WIDTH + (TILESIZE * 3), HEIGHT + (TILESIZE * 3)}));
while (window.isOpen()) {
window.clear(sf::Color::Black);
text.setString(std::to_string(player.timers.dash_cooldown));
@@ -77,6 +86,11 @@ int main() {
player.timers.level_switch_cooldown = player.timers.level_switch_cooldown_max;
}
else if(current_level == 1) {
load_map(wall_list, test_level_2);
current_level = 2;
player.timers.level_switch_cooldown = player.timers.level_switch_cooldown_max;
}
else if(current_level == 2) {
load_map(wall_list, test_level_0);
current_level = 0;
player.timers.level_switch_cooldown = player.timers.level_switch_cooldown_max;
@@ -108,7 +122,9 @@ int main() {
window.draw(wall_list[i][j]->rect);
}
#endif
// window.setView(view1);
window.draw(player.rect);
window.draw(enemy.rect);
window.draw(text);
window.display();
}