@ -22,7 +22,6 @@ INCLUDE_EMITTER_LIST
//360x240
vi2d WINDOW_SIZE = { 24 * 15 , 24 * 10 } ;
safemap < std : : string , Animate2D : : FrameSequence > ANIMATION_DATA ;
std : : map < int , std : : vector < std : : pair < int , float > > > TILE_ANIMATION_DATA ;
std : : vector < Monster > MONSTER_LIST ;
std : : vector < MonsterSpawner > SPAWNER_LIST ;
std : : vector < std : : shared_ptr < DamageNumber > > DAMAGENUMBER_LIST ;
@ -73,7 +72,6 @@ Crawler::Crawler()
}
bool Crawler : : OnUserCreate ( ) {
InitializeLevels ( ) ;
player = std : : make_unique < Warrior > ( ) ;
@ -133,12 +131,12 @@ bool Crawler::OnUserCreate(){
InitializeClasses ( ) ;
ChangePlayerClass ( WARRIOR ) ;
Warrior : : ability4 = Ranger : : ability1 ; //Class ability swapping demonstration.
return true ;
}
bool Crawler : : OnUserUpdate ( float fElapsedTime ) {
fElapsedTime = std : : clamp ( fElapsedTime , 0.f , 1 / 60.f ) ; //HACK fix. We can't have a negative time. Although using a more precise system clock should make this never occur. Also make sure if the game is too slow we advance by only 1/60th of a second.
fElapsedTime = std : : clamp ( fElapsedTime , 0.f , 1 / 30.f ) ; //HACK fix. We can't have a negative time. Although using a more precise system clock should make this never occur. Also make sure if the game is too slow we advance by only 1/30th of a second.
levelTime + = fElapsedTime ;
HandleUserInput ( fElapsedTime ) ;
UpdateEffects ( fElapsedTime ) ;
player - > Update ( fElapsedTime ) ;
@ -872,6 +870,8 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){
MAP_TILESETS [ " assets/maps/ " + baseSourceDir ] . upperForegroundTiles = tileset . GetData ( ) . UpperForegroundTileData ;
MAP_TILESETS [ " assets/maps/ " + baseSourceDir ] . collision = tileset . GetData ( ) . CollisionData ;
MAP_TILESETS [ " assets/maps/ " + baseSourceDir ] . staircaseTiles = tileset . GetData ( ) . StaircaseData ;
MAP_TILESETS [ " assets/maps/ " + baseSourceDir ] . animationData = tileset . GetData ( ) . AnimationData ;
std : : cout < < " assets/maps/ " + baseSourceDir < < " Animation Data Size: " < < MAP_TILESETS [ " assets/maps/ " + baseSourceDir ] . animationData . size ( ) < < std : : endl ;
r - > Load ( " assets/maps/ " + tileset . GetData ( ) . ImageData . data [ " source " ] ) ;
}
}
@ -882,6 +882,7 @@ void Crawler::LoadLevel(MapName map){
foregroundTileGroups . clear ( ) ;
currentLevel = map ;
WORLD_SIZE = { MAP_DATA [ map ] . MapData . width , MAP_DATA [ map ] . MapData . height } ;
levelTime = 0 ;
# pragma region Monster Spawn Data Setup
for ( auto key : MAP_DATA [ map ] . SpawnerData ) {