Loaded slime animation sheet

pull/28/head
sigonasr2 2 years ago
parent 1e0e40c77b
commit 776bf9165d
  1. 6
      Crawler/Animation.h
  2. BIN
      Crawler/assets/slime.png
  3. 54
      Crawler/main.cpp

@ -2,5 +2,9 @@
enum AnimationState{
WALK_S,WALK_E,WALK_N,WALK_W,
IDLE_S,IDLE_E,IDLE_N,IDLE_W
IDLE_S,IDLE_E,IDLE_N,IDLE_W,
GREEN_SLIME_IDLE,GREEN_SLIME_ROLL,GREEN_SLIME_JUMP,GREEN_SLIME_SPIT,GREEN_SLIME_DIE,
BLUE_SLIME_IDLE,BLUE_SLIME_ROLL,BLUE_SLIME_JUMP,BLUE_SLIME_SPIT,BLUE_SLIME_DIE,
RED_SLIME_IDLE,RED_SLIME_ROLL,RED_SLIME_JUMP,RED_SLIME_SPIT,RED_SLIME_DIE,
YELLOW_SLIME_IDLE,YELLOW_SLIME_ROLL,YELLOW_SLIME_JUMP,YELLOW_SLIME_SPIT,YELLOW_SLIME_DIE,
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

@ -94,7 +94,7 @@ class Crawler : public olc::PixelGameEngine
Camera2D camera;
TileTransformedView view;
Player player=Player{{}};
Renderable GFX_Pl_sheet;
Renderable GFX_Pl_Sheet,GFX_Slime_Sheet;
public:
Crawler()
@ -113,7 +113,8 @@ public:
camera.EnableWorldBoundary(true);
//Graphics
GFX_Pl_sheet.Load("assets/nico-warrior.png");
GFX_Pl_Sheet.Load("assets/nico-warrior.png");
GFX_Slime_Sheet.Load("assets/slime.png");
//Animations
InitializeAnimations();
@ -147,41 +148,50 @@ public:
void InitializeAnimations(){
Animate2D::FrameSequence pl_walk_s{0.2};
pl_walk_s.AddFrame({&GFX_Pl_sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_sheet,{vi2d{1,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_sheet,{vi2d{2,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_Sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_Sheet,{vi2d{1,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_Sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&GFX_Pl_Sheet,{vi2d{2,0}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WALK_S]=pl_walk_s;
Animate2D::FrameSequence pl_walk_e{0.2};
pl_walk_e.AddFrame({&GFX_Pl_sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_sheet,{vi2d{1,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_sheet,{vi2d{2,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_Sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_Sheet,{vi2d{1,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_Sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&GFX_Pl_Sheet,{vi2d{2,3}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WALK_E]=pl_walk_e;
Animate2D::FrameSequence pl_walk_w{0.2};
pl_walk_w.AddFrame({&GFX_Pl_sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_sheet,{vi2d{1,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_sheet,{vi2d{2,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_Sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_Sheet,{vi2d{1,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_Sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&GFX_Pl_Sheet,{vi2d{2,2}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WALK_W]=pl_walk_w;
Animate2D::FrameSequence pl_walk_n{0.2};
pl_walk_n.AddFrame({&GFX_Pl_sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_sheet,{vi2d{1,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_sheet,{vi2d{2,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_Sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_Sheet,{vi2d{1,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_Sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&GFX_Pl_Sheet,{vi2d{2,1}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WALK_N]=pl_walk_n;
Animate2D::FrameSequence pl_idle_s;
pl_idle_s.AddFrame({&GFX_Pl_sheet,{vi2d{0,0}*24,{24,24}}});
pl_idle_s.AddFrame({&GFX_Pl_Sheet,{vi2d{0,0}*24,{24,24}}});
ANIMATION_DATA[AnimationState::IDLE_S]=pl_idle_s;
Animate2D::FrameSequence pl_idle_e;
pl_idle_e.AddFrame({&GFX_Pl_sheet,{vi2d{0,3}*24,{24,24}}});
pl_idle_e.AddFrame({&GFX_Pl_Sheet,{vi2d{0,3}*24,{24,24}}});
ANIMATION_DATA[AnimationState::IDLE_E]=pl_idle_e;
Animate2D::FrameSequence pl_idle_w;
pl_idle_w.AddFrame({&GFX_Pl_sheet,{vi2d{0,2}*24,{24,24}}});
pl_idle_w.AddFrame({&GFX_Pl_Sheet,{vi2d{0,2}*24,{24,24}}});
ANIMATION_DATA[AnimationState::IDLE_W]=pl_idle_w;
Animate2D::FrameSequence pl_idle_n;
pl_idle_n.AddFrame({&GFX_Pl_sheet,{vi2d{0,1}*24,{24,24}}});
pl_idle_n.AddFrame({&GFX_Pl_Sheet,{vi2d{0,1}*24,{24,24}}});
ANIMATION_DATA[AnimationState::IDLE_N]=pl_idle_n;
for(int slime=0;slime<4;slime++){
for(int state=0;state<5;state++){
Animate2D::FrameSequence anim;
for (int frame=0;frame<10;frame++){
anim.AddFrame({&GFX_Slime_Sheet,{vi2d{frame,state+5*slime}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState(AnimationState::GREEN_SLIME_IDLE+state+slime*5)]=anim;
}
}
}
void HandleUserInput(float fElapsedTime){

Loading…
Cancel
Save