Music completed, new tilemap, fixed collider

This commit is contained in:
Alan Youngblood
2023-08-14 23:48:20 -04:00
parent 162f58b32f
commit de3b2dcdb0
24 changed files with 118 additions and 20 deletions

View File

@@ -147,14 +147,14 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
std::string kaijuTex = Game::projPath + "assets/textures/actors/kaijuturtle.png";
std::string fontTex = Game::projPath + "assets/textures/ui/ui-font-lorez5.png";
std::string textBoxTex = Game::projPath + "assets/textures/ui/ui-element-bubble.png";
std::string musicFile = Game::projPath + "assets/audio/music/sillypuppy.ogg";
std::string musicFile = Game::projPath + "assets/audio/music/neuwave.ogg";
std::string sfxFile = Game::projPath + "assets/audio/sfx/bwoop.wav";
assets->AddTexture("player", kaijuTex.c_str());
assets->AddTexture("font", fontTex.c_str());
assets->AddTexture("textBox", textBoxTex.c_str());
assets->AddMusicTrack("simonZ",musicFile.c_str());
assets->AddMusicTrack("neuwave",musicFile.c_str());
assets->AddSoundClip("bwoop",sfxFile.c_str());
@@ -179,11 +179,11 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
//ecs implementation
player.addComponent<TransformComponent>(150*gScale,100*gScale,32,32,globalScale,3); // 180,120
player.addComponent<TransformComponent>(150*gScale,100*gScale,32,32,globalScale,2); // 180,120
player.addComponent<SpriteComponent>("player", SpriteComponent::spriteAnimation, "assets/textures/actors/kaijuturtle.json");
// player.addComponent<PlayerController>(0.0,0.0,false,false,Vector2D().Zero());
player.addComponent<ColliderComponent>("player",16*globalScale,32*globalScale, true, 2*globalScale,10*globalScale, "collider");
player.addComponent<ColliderComponent>("player",20*globalScale,20*globalScale, true, 0*globalScale,0*globalScale, "");
player.addComponent<KeyboardController>();
player.addGroup(groupPlayers);
@@ -191,8 +191,8 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
levelMap.y = 0;
// printf("Trying to load Tilemap\n");
std::string mapPath = Game::projPath + "assets/maps/kaiju-city-map.json";
gameScene.addComponent<TileMapComponent>(mapPath,"kaiju-city","Tile Layer 1","Collision",gScale,player.getComponent<TransformComponent>().position.x+player.getComponent<TransformComponent>().width/2,player.getComponent<TransformComponent>().position.y+player.getComponent<TransformComponent>().height/2); //150,100
std::string mapPath = Game::projPath + "assets/maps/kaiju-city-map2.json";
gameScene.addComponent<TileMapComponent>(mapPath,"kaiju-city-ts","Tile Layer 1","Collision",gScale,player.getComponent<TransformComponent>().position.x+player.getComponent<TransformComponent>().width/2,player.getComponent<TransformComponent>().position.y+player.getComponent<TransformComponent>().height/2); //150,100
gameScene.addGroup(groupMap);
// printf("Completed loading Tilemap\n");
@@ -248,7 +248,7 @@ void Game::update()
if (Mix_PlayingMusic() == 0 && gsm->currentState == GameStateManager::ST_COREGAME)
{
// std::cout << "Play Music Now" << std::endl;
Mix_PlayMusic(assets->GetMusicTrack("simonZ"), -1);
Mix_PlayMusic(assets->GetMusicTrack("neuwave"), -1);
}
if (Mix_PlayingMusic() != 0 && gsm->currentState != GameStateManager::ST_COREGAME)
{