added an ammo indicator(for debug purposes)

This commit is contained in:
Ethan Adams 2024-08-20 14:43:34 -04:00
parent d22757fd93
commit 6ee1e08e2a
4 changed files with 14 additions and 2 deletions

View file

@ -4,7 +4,7 @@
<sprite path="sprites/machineGunAtlas256.png" frameSize="256.0"/> <sprite path="sprites/machineGunAtlas256.png" frameSize="256.0"/>
</animation> </animation>
<animation name="machine_gun_reload_anim" type="reload"> <animation name="machine_gun_reload_anim" type="reload">
<FPS>2</FPS> <FPS>6</FPS>
<sprite path="sprites/machineGunAtlasReload256.png" frameSize="256.0"/> <sprite path="sprites/machineGunAtlasReload256.png" frameSize="256.0"/>
</animation> </animation>
</animations> </animations>

View file

@ -34,7 +34,7 @@
</spriteids> </spriteids>
</map> </map>
<entities> <entities>
<player x="7" y="5" weapon="pistolGun"> <player x="7" y="5" weapon="shotGun">
<animation name="player_anim"/> <animation name="player_anim"/>
</player> </player>
<entity x="10" y="3" weapon="pistolGun"> <entity x="10" y="3" weapon="pistolGun">

View file

@ -59,6 +59,8 @@ public:
float getBulletSpeed() const { return bulletSpeed; } float getBulletSpeed() const { return bulletSpeed; }
glm::vec2 getBulletSize() const { return bulletSize; } glm::vec2 getBulletSize() const { return bulletSize; }
std::shared_ptr<GameActor> getWielder() const { return wielder; } std::shared_ptr<GameActor> getWielder() const { return wielder; }
const Uint32 getMagazine() const { return weaponMag; }
const Uint32 getAmmo() const { return weaponAmmo; }
Weapon::BulletData genBulletData (); Weapon::BulletData genBulletData ();
void createBullet (const BulletData& data); void createBullet (const BulletData& data);

View file

@ -1,6 +1,10 @@
#include "gameplay/game.h" #include "gameplay/game.h"
#include "gameplay/input.h" #include "gameplay/input.h"
#include "gameplay/scene.h" #include "gameplay/scene.h"
/*due for possible removal!*/
#include "gameplay/gameactor.h"
#include "gameplay/weapons/weapon.h"
/*-------------------------*/
#include "utility/command.h" #include "utility/command.h"
#include "utility/resourcemanager.h" #include "utility/resourcemanager.h"
@ -82,7 +86,13 @@ void Game::render()
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
if (currentScene) if (currentScene)
{
currentScene->render(); currentScene->render();
/*Debug ammo indicator*/
textHandler->DrawText("comic.ttf", std::to_string(currentScene->getPlayer()->getHeldWeapon()->get()->getMagazine()), glm::vec2(10, 10), 0.5f);
textHandler->DrawText("comic.ttf", "/", glm::vec2(50, 10), 0.5f);
textHandler->DrawText("comic.ttf", std::to_string(currentScene->getPlayer()->getHeldWeapon()->get()->getAmmo()), glm::vec2(90, 10), 0.5f);
}
window->swap(); window->swap();
} }