-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrickBall.h
94 lines (92 loc) · 2.17 KB
/
TrickBall.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#pragma once
#include "FontPool.h"
#include "EXPUnit.h"
#include "Item.h"
#include "RenderPool.h"
#include "Bullet.h"
#ifndef TRICKBALL_H_
#define TRICKBALL_H_
class TrickBall :
public GameObject
{
public:
TrickBall
(float x1, float y1, double speed1,
int HP1, int MP1, int DEF1, int type1 = TRICKBALL) :GameObject(x1, y1, speed1, HP1, MP1, DEF1,0)
{
HGE *hge = hgeCreate(HGE_VERSION);
type = type1;
bomb = false;
trigger = false;
bullets = 0;
bullettimer = hge->Random_Int(150,250);
SetDMG((Hero::GetHero().GetLevel() + 1) * 5);
if (hge->Random_Int(0, 30) < Hero::GetHero().GetLevel())
innertype = hge->Random_Int(1, 2);
else
innertype = 0;
switch (innertype)
{
case 1:
SetChangeColor(255, 255, 255, 0);
break;
case 2:
SetChangeColor(255, 0, 0, 255);
break;
}
};
~TrickBall();
virtual void action();
virtual void born(){ Swell(); };
virtual void death()
{
switch (type)
{
case TRICKBALL:
Contract();
if (this->IsDead() && !this->IsPlayedDeadAnim())
{
SetPlayedDeadAnim();
RenderPool::GetRenderPool().InstantRender(GetX(), GetY(), TRICKBALL, GetRot());
if (!IsForcedToDie())Hero::GetHero().AddScore(1);
}
break;
case SLOWBOMBBALL:
if (!bomb && !IsAlive() && finishb)
{
bomb = true;
Bullet *bul = new Bullet(GetX(), GetY(), BULLET3, 100);
ObjectPool::GetObjPool().InsertObject(bul, true);
}
Contract();
break;
case BULLETBALL:
Contract();
if (this->IsDead() && !this->IsPlayedDeadAnim())
{
SetPlayedDeadAnim();
RenderPool::GetRenderPool().InstantRender(GetX(), GetY(), BULLETBALL, GetRot());
if (!IsForcedToDie())Hero::GetHero().AddScore(3);
}
break;
}
HGE *hge = hgeCreate(HGE_VERSION);
for (int i = 0; i < hge->Random_Int(5, 9); i++)
{
EXPUnit *expunit = new EXPUnit(GetX(), GetY());
ObjectPool::GetObjPool().InsertObject(expunit, true);
}
SFXManager::GetSFXManager().PlaySFX(ENEMYBOOMSFX1 + hge->Random_Int(0, 1));
};
virtual int TellType(){ return type; };
virtual int GetCollisionRange(){ return 32; };
virtual bool IsEnemy(){ return true; };
private:
int type;
bool bomb;
int bullettimer;
bool trigger;
int innertype;
int bullets;
};
#endif