-
Notifications
You must be signed in to change notification settings - Fork 0
/
MonsterDie4.cpp
64 lines (54 loc) · 991 Bytes
/
MonsterDie4.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"
MonsterDie4::MonsterDie4()
{
}
MonsterDie4::~MonsterDie4()
{
}
void MonsterDie4::Init()
{
m_Sprite.LoadTextureFromFile("Texture/MonsterDie4.png");
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(0.f, 0.f, 128.f, 140.f);
m_Sprite.SetImageSize(128.f, 140.f);
}
void MonsterDie4::Render()
{
m_Sprite.SetColor(25, 25, 25, 255);
m_Sprite.OnRender();
}
void MonsterDie4::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 MonsterDie4::Sprite(float deltatime)
{
m_fCount += deltatime;
if (m_fCount >= 0.1f)
{
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(128.f * m_iFrame, 0.f, 128.f, 140.f);
m_Sprite.SetImageSize(128.f, 140.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;
}
}