-
Notifications
You must be signed in to change notification settings - Fork 0
/
BunkerPiece.cpp
41 lines (37 loc) · 928 Bytes
/
BunkerPiece.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
#include "BunkerPiece.h"
BunkerPiece::BunkerPiece( const RectF &rectangle, SDL_Color color ) :
Sprite( rectangle, color ) {
name = "BunkerPiece/" + name;
collisionType = ICollideableType::BunkerPiece;
deathSound = SFXId::ExplodeBunker;
if( withChance( .1 ) ) {
itemDrop = AnimationId::ItemPlus1;
}
else if( withChance( .05 ) ) {
itemDrop = AnimationId::ItemShield;
}
}
void BunkerPiece::onHit( ICollideable *o ) {
switch( o->collisionType ) {
case ICollideableType::Bullet:
die();
break;
case ICollideableType::Bunker:
break;
case ICollideableType::BunkerPiece:
break;
case ICollideableType::Invader:
die();
break;
case ICollideableType::Item:
break;
case ICollideableType::Player:
break;
case ICollideableType::UFO:
break;
case ICollideableType::NotCollideable:
default:
error( "Colliding with non-collideable" );
break;
}
}