-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bat.cpp
68 lines (61 loc) · 1.23 KB
/
Bat.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
65
66
67
68
//Bat.cpp - Jailbreak Bat SubClass Definitions
//Written by Ethan Goff, April 2013
//Uses Dark GDK, http://www.thegamecreators.com/?m=view_product&id=2128
#pragma once
#include "Bat.h"
//Constructors
Bat::Bat() : AICharacter() {}
Bat::Bat(int spriteID, int x, int y, int initialImageID, Direction initialDirection, unsigned int velocity) : AICharacter(spriteID, x, y, initialImageID, initialDirection, velocity)
{}
//Animation Methods
void Bat::DeathAnimate()
{
FSDeath++;
FSLDeathAnimation++;
if(FSDeath < 2*FRAME_RATE)
{
CurrentImageID = IMG_SPIDER_DEATH_1 + (FSDeath/12);
DrawSprite();
}
else if(FSDeath == 2* FRAME_RATE)
{
dbDeleteSprite(SpriteID);
}
else if(FSDeath < 10*FRAME_RATE)
{
}
else
{
Respawn = true;
}
}
void Bat::Animate()
{
FSLAnimation++;
if(FSLAnimation > 10)
{
FSLAnimation = 0;
switch(CurrentDirection)
{
case left:
case right:
case up:
case down:
switch(CurrentImageID)
{
case IMG_BAT_UP:
SpriteOffset_Y = -20;
CurrentImageID = IMG_BAT_DOWN;
break;
case IMG_BAT_DOWN:
SpriteOffset_Y = 0;
CurrentImageID = IMG_BAT_UP;
break;
}
break;
case none:
CurrentImageID = IMG_BAT_UP;
break;
}
}
}