Boss name overlays added to map editor and game.
This commit is contained in:
parent
13c20abc1c
commit
c4db27a78d
@ -123,6 +123,7 @@ bool Crawler::OnUserCreate(){
|
||||
bool Crawler::OnUserUpdate(float fElapsedTime){
|
||||
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;
|
||||
bossDisplayTimer=std::max(0.f,bossDisplayTimer-fElapsedTime);
|
||||
HandleUserInput(fElapsedTime);
|
||||
UpdateEffects(fElapsedTime);
|
||||
player->Update(fElapsedTime);
|
||||
@ -1024,6 +1025,21 @@ void Crawler::RenderHud(){
|
||||
std::string displayText=player->notificationDisplay.first;
|
||||
DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)-24}-GetTextSizeProp(displayText)/2,displayText,BLUE,VERY_DARK_BLUE);
|
||||
}
|
||||
if(bossDisplayTimer>0){
|
||||
std::string displayText="- "+bossName+" -";
|
||||
|
||||
uint8_t alpha=0;
|
||||
if(bossDisplayTimer>4){
|
||||
alpha=uint8_t((5-bossDisplayTimer)*255);
|
||||
}else
|
||||
if(bossDisplayTimer>1){
|
||||
alpha=255;
|
||||
}else{
|
||||
alpha=uint8_t((bossDisplayTimer)*255);
|
||||
}
|
||||
vf2d textScale={3,5};
|
||||
DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/2)}-vf2d{GetTextSizeProp(displayText)}*textScale/2,displayText,{252, 186, 3, alpha},{128,0,0,alpha},textScale,2);
|
||||
}
|
||||
std::string versionStr("v" + std::to_string(VERSION_MAJOR) + "." + std::to_string(VERSION_MINOR) + "." + std::to_string(VERSION_PATCH) + "." + std::to_string(VERSION_BUILD));
|
||||
DrawShadowStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4,versionStr,WHITE,BLACK,{0.4,0.4},0.4);
|
||||
if("debug_player_info"_I){
|
||||
@ -1158,7 +1174,7 @@ void Crawler::LoadLevel(MapName map){
|
||||
int monsterTypeID=monster.GetInteger("value")-1;
|
||||
monster_list.push_back({monsterTypeID,{monster.GetInteger("x")-spawnData.ObjectData.GetFloat("x"),monster.GetInteger("y")-spawnData.ObjectData.GetFloat("y")}});
|
||||
}
|
||||
SPAWNER_LIST.push_back(MonsterSpawner{{spawnData.ObjectData.GetFloat("x"),spawnData.ObjectData.GetFloat("y")},spawnerRadius*2,monster_list,spawnData.upperLevel});
|
||||
SPAWNER_LIST.push_back(MonsterSpawner{{spawnData.ObjectData.GetFloat("x"),spawnData.ObjectData.GetFloat("y")},spawnerRadius*2,monster_list,spawnData.upperLevel,spawnData.bossNameDisplay});
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
@ -1588,4 +1604,9 @@ void Crawler::InitializeDefaultKeybinds(){
|
||||
KEY_UP.AddKeybind({KEY,W});
|
||||
KEY_DOWN.AddKeybind({KEY,DOWN});
|
||||
KEY_DOWN.AddKeybind({KEY,S});
|
||||
}
|
||||
|
||||
void Crawler::SetBossNameDisplay(std::string name,float time){
|
||||
bossName=name;
|
||||
bossDisplayTimer=time;
|
||||
}
|
@ -52,6 +52,8 @@ private:
|
||||
float reflectionStepTime=0;
|
||||
std::set<vi2d>visibleTiles;
|
||||
std::vector<Monster>monstersToBeSpawned;
|
||||
float bossDisplayTimer=0;
|
||||
std::string bossName;
|
||||
public:
|
||||
Crawler();
|
||||
bool OnUserCreate() override;
|
||||
@ -117,6 +119,7 @@ public:
|
||||
void DrawPie(vf2d center,float radius,float degreesCut,Pixel col);
|
||||
void RenderCooldowns();
|
||||
void InitializeDefaultKeybinds();
|
||||
void SetBossNameDisplay(std::string name,float time=5);
|
||||
|
||||
struct TileGroupData{
|
||||
vi2d tilePos;
|
||||
|
@ -171,6 +171,11 @@
|
||||
"drawFill": true,
|
||||
"id": 2,
|
||||
"members": [
|
||||
{
|
||||
"name": "Boss Title Display",
|
||||
"type": "string",
|
||||
"value": ""
|
||||
}
|
||||
],
|
||||
"name": "SpawnGroup",
|
||||
"type": "class",
|
||||
|
@ -274,8 +274,8 @@ vf2d&Monster::GetTargetPos(){
|
||||
}
|
||||
|
||||
MonsterSpawner::MonsterSpawner(){}
|
||||
MonsterSpawner::MonsterSpawner(vf2d pos,vf2d range,std::vector<std::pair<int,vf2d>>monsters,bool upperLevel):
|
||||
pos(pos),range(range),monsters(monsters),upperLevel(upperLevel){
|
||||
MonsterSpawner::MonsterSpawner(vf2d pos,vf2d range,std::vector<std::pair<int,vf2d>>monsters,bool upperLevel,std::string bossNameDisplay)
|
||||
:pos(pos),range(range),monsters(monsters),upperLevel(upperLevel),bossNameDisplay(bossNameDisplay){
|
||||
}
|
||||
bool MonsterSpawner::SpawnTriggered(){
|
||||
return triggered;
|
||||
@ -293,6 +293,9 @@ void MonsterSpawner::SetTriggered(bool trigger,bool spawnMonsters){
|
||||
for(std::pair<int,vf2d>&monsterInfo:monsters){
|
||||
game->SpawnMonster(pos+monsterInfo.second,&MONSTER_DATA[monsterInfo.first],DoesUpperLevelSpawning());
|
||||
}
|
||||
if(bossNameDisplay!=""){
|
||||
game->SetBossNameDisplay(bossNameDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,10 +169,11 @@ struct MonsterSpawner{
|
||||
std::vector<std::pair<int,vf2d>>monsters;
|
||||
bool triggered=false;
|
||||
bool upperLevel=false;
|
||||
std::string bossNameDisplay="";
|
||||
public:
|
||||
MonsterSpawner();
|
||||
//For the monster list, the second pair item is the position relative to the spawner to spawn the monster.
|
||||
MonsterSpawner(vf2d pos,vf2d range,std::vector<std::pair<int,vf2d>>MONSTER_LIST,bool upperLevel=false);
|
||||
MonsterSpawner(vf2d pos,vf2d range,std::vector<std::pair<int,vf2d>>MONSTER_LIST,bool upperLevel=false,std::string bossNameDisplay="");
|
||||
bool SpawnTriggered();
|
||||
vf2d GetRange();
|
||||
vf2d GetPos();
|
||||
|
@ -33,6 +33,7 @@ struct SpawnerTag{
|
||||
XMLTag ObjectData;
|
||||
std::vector<XMLTag>monsters;
|
||||
bool upperLevel=false;
|
||||
std::string bossNameDisplay;
|
||||
std::string str();
|
||||
friend std::ostream& operator << (std::ostream& os, SpawnerTag& rhs);
|
||||
};
|
||||
@ -56,6 +57,7 @@ class TMXParser{
|
||||
Map parsedMapInfo;
|
||||
bool buildingSpawner=false;
|
||||
SpawnerTag obj;
|
||||
int prevSpawner;
|
||||
void ParseTag(std::string tag);
|
||||
int monsterPropertyTagCount=-1;
|
||||
XMLTag monsterTag;
|
||||
@ -225,6 +227,10 @@ typedef std::map<std::string,std::vector<geom2d::rect<int>>> ZoneData;
|
||||
}else
|
||||
if (newTag.tag=="object"&&newTag.data["type"]=="SpawnGroup") {
|
||||
parsedMapInfo.SpawnerData[newTag.GetInteger("id")]={newTag};
|
||||
prevSpawner=newTag.GetInteger("id");
|
||||
} else
|
||||
if (newTag.tag=="property"&&newTag.data["name"]=="Boss Title Display") {
|
||||
parsedMapInfo.SpawnerData[prevSpawner].bossNameDisplay=newTag.data["value"];
|
||||
} else
|
||||
if (newTag.tag=="object"&&newTag.data["type"]=="PlayerSpawnLocation") {
|
||||
parsedMapInfo.MapData.playerSpawnLocation={newTag.GetInteger("x")-newTag.GetInteger("width")/2,newTag.GetInteger("y")-newTag.GetInteger("height")/2};
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 1559
|
||||
#define VERSION_BUILD 1567
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
@ -257,6 +257,9 @@
|
||||
<objectgroup id="4" name="Object Layer 1">
|
||||
<object id="2" name="Player Spawn" type="PlayerSpawnLocation" x="720" y="1248" width="24" height="24"/>
|
||||
<object id="3" name="Slime King Spawn Area" type="SpawnGroup" x="234" y="384" width="1110" height="834">
|
||||
<properties>
|
||||
<property name="Boss Title Display" value="Slime King"/>
|
||||
</properties>
|
||||
<ellipse/>
|
||||
</object>
|
||||
<object id="4" name="Slime King" type="Monster" x="792" y="744">
|
||||
|
@ -42,12 +42,11 @@ Wizard
|
||||
Precast Time = 0
|
||||
Casting Range = 0
|
||||
Casting Size = 0
|
||||
|
||||
|
||||
TeleportRange = 650
|
||||
|
||||
AnimationTime = 0.35
|
||||
IframeTime = 0.35
|
||||
IframeTime = 0.5
|
||||
|
||||
# The minimum tile range required for a teleport.
|
||||
TilesMin = 1
|
||||
|
@ -10,7 +10,7 @@ gfx_config = gfx/gfx.txt
|
||||
map_config = levels.txt
|
||||
|
||||
# Starting map when loading the game.
|
||||
starting_map = CAMPAIGN_1_1
|
||||
starting_map = BOSS_1
|
||||
|
||||
# Player Properties Loading Config
|
||||
player_config = Player.txt
|
||||
|
Loading…
x
Reference in New Issue
Block a user