|
|
|
@ -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){ |
|
|
|
|