From 6dcc7e736da250709f6114c62de71e42e2834e78 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 4 Sep 2023 18:24:21 -0500 Subject: [PATCH] Stupid bullet. Also fixed WIZARD_IDLE animations missing. --- Crawler/Crawler.cpp | 11 ++----- Crawler/Version.h | 2 +- Crawler/assets/config/Player.txt | 1 + Crawler/buildtemplate.html | 2 +- Crawler/olcPixelGameEngine.h | 49 ++++++++++++++++++++++----- Crawler/pge.data | 55 +++++++++++++++++++++++-------- Crawler/pge.js | 2 +- Crawler/pge.wasm | Bin 699851 -> 702345 bytes x64/Release/Crawler.exe | Bin 541696 -> 552448 bytes 9 files changed, 89 insertions(+), 33 deletions(-) diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index fc4412ca..23b50cc0 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -138,7 +138,7 @@ bool Crawler::OnUserCreate(){ } bool Crawler::OnUserUpdate(float fElapsedTime){ - fElapsedTime=std::clamp(fElapsedTime,0.f,1/60.f); + 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. HandleUserInput(fElapsedTime); UpdateEffects(fElapsedTime); player->Update(fElapsedTime); @@ -436,13 +436,8 @@ void Crawler::UpdateBullets(float fElapsedTime){ moveStep=(b->vel*fElapsedTime).norm(); } while(totalDistance>0){ - if(totalDistance>=1){ - b->pos+=moveStep; - totalDistance--; - } else { - b->pos+=moveStep*totalDistance; - totalDistance=0; - } + totalDistance=std::max(0.f,totalDistance-1); + b->pos+=moveStep; if(b->friendly){ for(Monster&m:MONSTER_LIST){ if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b->pos,b->radius))){ diff --git a/Crawler/Version.h b/Crawler/Version.h index e337de8e..1808f47b 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 1025 +#define VERSION_BUILD 1033 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/Player.txt b/Crawler/assets/config/Player.txt index e78b44ee..a67e94f0 100644 --- a/Crawler/assets/config/Player.txt +++ b/Crawler/assets/config/Player.txt @@ -24,4 +24,5 @@ Player PLAYER_ANIMATION[8] = WIZARD_IDLE_ATTACK PLAYER_ANIMATION[9] = WIZARD_ATTACK PLAYER_ANIMATION[10] = WIZARD_CAST + PLAYER_ANIMATION[11] = WIZARD_IDLE } \ No newline at end of file diff --git a/Crawler/buildtemplate.html b/Crawler/buildtemplate.html index 7e6698dd..c794496f 100644 --- a/Crawler/buildtemplate.html +++ b/Crawler/buildtemplate.html @@ -35,7 +35,7 @@ var Module = { })(), }; - +