maps are more efficient to make and run on memory

This commit is contained in:
DarthMooMancer
2025-10-26 16:47:16 -04:00
parent 5e5f712a84
commit cd19e841a5
6 changed files with 135 additions and 105 deletions
+2 -6
View File
@@ -4,6 +4,7 @@
#include <SFML/Graphics/Color.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/System/Vector2.hpp>
#include "scheduler.hpp"
#include "globals.hpp"
enum class CollisionDir { None, Left, Right, Top, Bottom };
@@ -24,11 +25,6 @@ protected:
float _border_thickness;
};
struct Player_timers {
float dash_cooldown { 0 };
float dash_cooldown_max { 5 };
};
class Player : public Entity {
public:
Player(sf::Vector2<float> size, sf::Vector2<float> pos, sf::Vector2f velocity, float border_thickness, float gravity, float max_acceleration, float dash_distance, sf::Color inside_color, sf::Color border_color);
@@ -37,7 +33,7 @@ public:
float m_dash_distance;
bool m_jumping;
bool m_dash;
Player_timers timers;
Times timers;
void handle_movment();
void handle_gravity();
bool get_jumping();
+5 -2
View File
@@ -4,7 +4,10 @@
#include "globals.hpp"
#include "elements.hpp"
extern int map_data[MAX_ROWS][MAX_COLS];
void merged_walls(Entity* wall_list[MAX_ROWS][MAX_COLS]);
extern char test_level_0[MAX_ROWS][MAX_COLS];
extern char test_level_1[MAX_ROWS][MAX_COLS];
void clear_map(Entity* wall_list[MAX_ROWS][MAX_COLS]);
void load_map(Entity* wall_list[MAX_ROWS][MAX_COLS], const char map_data[MAX_ROWS][MAX_COLS]);
#endif
+8 -1
View File
@@ -1,7 +1,14 @@
#ifndef SCHEDULER_HPP
#define SCHEDULER_HPP
struct Times {
float dash_cooldown { 0 };
float dash_cooldown_max { 5 };
float level_switch_cooldown { 0 };
float level_switch_cooldown_max { 1 };
};
struct Timer {
void update_timers(bool &running, float &dash_timer);
void update_timers(bool &running, Times &times);
};
#endif