Fix bug with missing return value for effect updating.

This commit is contained in:
sigonasr2 2023-06-16 02:33:12 -05:00
parent 9db2565060
commit 2f95e71114
10 changed files with 14 additions and 9 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
*.userosscache
*.sln.docstates
emsdk
emscripten
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

View File

@ -19,6 +19,7 @@ bool Effect::Update(float fElapsedTime){
}
}
animation.UpdateState(internal_animState,fElapsedTime);
return true;
}
void Effect::Draw(){

View File

@ -4,10 +4,10 @@
#include "olcUTIL_Animate2D.h"
struct Effect{
vf2d pos;
float lifetime;
float fadeout;
float size;
vf2d pos={0,0};
float lifetime=0;
float fadeout=0;
float size=1;
Effect(vf2d pos,float lifetime,AnimationState animation,float size=1.0f,float fadeout=0.0f);
bool Update(float fElapsedTime);
Animate2D::Frame GetFrame();

View File

@ -14,11 +14,12 @@ INCLUDE_game
const float Player::GROUND_SLAM_SPIN_TIME=0.6f;
const float Player::GROUND_SLAM_COOLDOWN=20;
Player::Player(){
Player::Player():
state(State::NORMAL),lastReleasedMovementKey(DOWN),facingDirection(DOWN){
}
Player::Player(vf2d pos):
pos(pos){
pos(pos),state(State::NORMAL),lastReleasedMovementKey(DOWN),facingDirection(DOWN){
}
void Player::SetX(float x){
@ -127,7 +128,6 @@ void Player::Update(float fElapsedTime){
default:{
//Update animations normally.
}
[[fallthrough]];
}
animation.UpdateState(internal_animState,fElapsedTime);
groundSlamCooldown=std::max(0.f,groundSlamCooldown-fElapsedTime);

View File

@ -22,7 +22,7 @@ private:
float spin_angle=0;
float lastAnimationFlip=0;
float groundSlamCooldown=0;
State state;
State state=State::NORMAL;
Animate2D::Animation<AnimationState>animation;
Animate2D::AnimationState internal_animState;
Key lastReleasedMovementKey;

View File

@ -123,7 +123,8 @@ This means you can run your application in teh browser, great for distributing
and submission in to jams and things! It's a bit new at the moment.
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1 ./YourSource.cpp -o pge.html
em++ -std=c++17 -O2 -s ALLOW_MEMORY_GROWTH=1 -s MAX_WEBGL_VERSION=2 -s MIN_WEBGL_VERSION=2 -s USE_LIBPNG=1 $(Get-ChildItem *.cpp) -o
pge.html --preload-file assets
Using stb_image.h

BIN
Crawler/pge.data Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

1
Crawler/pge.html Normal file

File diff suppressed because one or more lines are too long

1
Crawler/pge.js Normal file

File diff suppressed because one or more lines are too long

BIN
Crawler/pge.wasm Normal file

Binary file not shown.