-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItem3.cpp
More file actions
69 lines (57 loc) · 1.23 KB
/
Copy pathItem3.cpp
File metadata and controls
69 lines (57 loc) · 1.23 KB
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
65
66
67
68
69
#include "stdafx.h"
Item3::Item3()
{
}
Item3::~Item3()
{
}
void Item3::Init()
{
m_Sprite.LoadTextureFromFile("Texture/Item3.png");
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(0.f, 0.f, 99.f, 86.f);
m_Sprite.SetImageSize(99.f, 86.f);
}
void Item3::Render()
{
m_Sprite.OnRender();
}
void Item3::Update(float deltatime)
{
Vector3 temp = m_Sprite.m_Position - m_GetAiPos;
m_Sprite.m_Position -= temp * deltatime * 5;
Sprite(deltatime);
}
bool Item3::CollisionTo(IObject * obj)
{
if (obj->Tag == "PlayerMap")
{
if (m_GetAiPos.x < m_Sprite.m_Position.x + 50)
{
PlayerAttBoom * m_pPlayerAttBoom = new PlayerAttBoom;
m_pPlayerAttBoom->m_bAi = false;
m_pPlayerAttBoom->Init();
m_pPlayerAttBoom->m_Sprite.m_Position = m_GetAiPos;
SceneManager::GetInstance()->GetNowScene()->m_ObjectManager.AddObject(m_pPlayerAttBoom);
SceneManager::GetInstance()->GetNowScene()->m_ObjectManager.RemoveObject(this);
return true;
}
}
return false;
}
void Item3::Sprite(float deltatime)
{
m_fCount += deltatime;
if (m_fCount >= 0.1f)
{
m_Sprite.SetCustomVB();
m_Sprite.SetImageUV(99.f * m_iFrame, 0.f, 99.f, 86.f);
m_Sprite.SetImageSize(99.f, 86.f);
m_iFrame++;
if (m_iFrame >= 5)
{
m_iFrame = 0;
}
m_fCount = 0.f;
}
}