diff --git a/Faceball2030/assets/powerups.png b/Faceball2030/assets/powerups.png new file mode 100644 index 0000000..8c4cc7e Binary files /dev/null and b/Faceball2030/assets/powerups.png differ diff --git a/Faceball2030/main.cpp b/Faceball2030/main.cpp index 80c66f6..f99cbdc 100644 --- a/Faceball2030/main.cpp +++ b/Faceball2030/main.cpp @@ -958,6 +958,16 @@ void FaceBall::RenderPowerupMesh(mat4x4& matView, std::vector& vecTria } } } + if (p.opened) { + Mesh mesh; + float uv = ((int)p.type - 1) * 0.125f; + mesh.tris.push_back({ {{-0.25,0,0},{0.25,0,0},{-0.25,0.5,0}},{{uv,1},{uv + 0.125f,1},{uv,0}},{WHITE,WHITE,WHITE},powerups_tex }); + mesh.tris.push_back({ {{-0.25,0.5,0},{0.25,0,0},{0.25,0.5,0}},{{uv,0},{uv + 0.125f,1},{uv + 0.125f,0}},{WHITE,WHITE,WHITE},powerups_tex }); + Object billboard = { + mesh,p.pos,std::atan2f(player.GetPos().z - p.pos.z,player.GetPos().x - p.pos.x) - PI / 2,0.25f + }; + RenderMesh(matView, vecTrianglesToRaster, billboard, false); + } } void FaceBall::RenderMeshDeathScreen(mat4x4& matView, std::vector& vecTrianglesToRaster, Object& o) { @@ -1508,6 +1518,7 @@ bool FaceBall::OnUserCreate() hudmeter = new Decal(new Sprite("assets/hudmeter.png")); powerup_tex = new Decal(new Sprite("assets/powerup.png")); powerup2_tex = new Decal(new Sprite("assets/powerup2.png")); + powerups_tex = new Decal(new Sprite("assets/powerups.png")); enemy_ShootMe = { "assets/enemies/ShootMe.obj", enemy_ShootMe_tex }; enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex }; diff --git a/Faceball2030/main.h b/Faceball2030/main.h index 250db53..65f0461 100644 --- a/Faceball2030/main.h +++ b/Faceball2030/main.h @@ -267,7 +267,8 @@ class FaceBall : public PixelGameEngine Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex, *enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_IShoot_tex, - *life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex; + *life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex, + *powerups_tex; vi2d exitCoords = { 0,0 }; std::vector>map; std::vectorobjects;