-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCStone.cpp
39 lines (37 loc) · 911 Bytes
/
CStone.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
#include "stdafx.h"
#include "Resource.h"
#include <mmsystem.h>
#include <ddraw.h>
#include "gamelib.h"
#include "CSprite.h"
#include "CResource.h"
#include "CStone.h"
#include "mygame.h"
namespace game_framework {
/////////////////////////////////////////////////////////////////////////////
// 石頭的class
/////////////////////////////////////////////////////////////////////////////
CStone::CStone(){
resourceTable = CResourceTable(0,0,0,1);
bmp = new CMovingBitmap();
bmp->LoadBitmapA("Bitmaps/Resource/stone.bmp",0);
icon=new CMovingBitmap();
icon->LoadBitmapA("Bitmaps/Icons/Units/stone.bmp",-1);
iconDialog.pic=*icon;
hp = 100;
this->maxHp = 100;
isAttackable = false;
isCollectable=true;
isRepairable=false;
}
CStone::~CStone(){
delete bmp;
delete icon;
}
void CStone::OnCollected(CSprite* sprite){//子類別需要給指定的
hp-=1;
if(hp<=0){
this->OnDie();
}
}
}