-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonsterDie2.cpp
64 lines (54 loc) · 986 Bytes
/
MonsterDie2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "stdafx.h"
MonsterDie2::MonsterDie2()
{
}
MonsterDie2::~MonsterDie2()
{
}
void MonsterDie2::Init()
{
m_Sprite.LoadTextureFromFile("Texture/MonsterDie2.png");
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(0.f, 0.f, 65.f, 134.f);
m_Sprite.SetImageSize(65.f, 134.f);
}
void MonsterDie2::Render()
{
m_Sprite.SetColor(25, 25, 25, 255);
m_Sprite.OnRender();
}
void MonsterDie2::Update(float deltatime)
{
if (m_iFrame == -1)
{
m_fCount1 += deltatime;
if (m_fCount1 >= 0.5f)
{
m_iFrame = 0;
m_fCount1 = 0.f;
}
}
else
{
Sprite(deltatime);
}
}
void MonsterDie2::Sprite(float deltatime)
{
m_fCount += deltatime;
if (m_fCount >= 0.1f)
{
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(65.f * m_iFrame, 0.f, 65.f, 134.f);
m_Sprite.SetImageSize(65.f, 134.f);
m_iFrame++;
if (m_iFrame >= 6)
{
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(0.f, 0.f, 0.f, 0.f);
m_Sprite.SetImageSize(0.f, 0.f);
m_iFrame = -1;
}
m_fCount = 0.f;
}
}