-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArrowBullet.h
35 lines (28 loc) · 1017 Bytes
/
ArrowBullet.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
#ifndef _ARROW_BULLET_H_
#define _ARROW_BULLET_H_
#include "Item.h"
class ArrowBullet : public Item
{
public:
static constexpr int ARROW_WIDTH = 8;
ArrowBullet();
ArrowBullet(bool isArrow);
virtual bool Update(UpdateStep step);
void Fire(int x, unsigned char y, bool isMovingToLeft);
void KillBulletWithoutSparks();
private:
static constexpr int BULLET_SPEED = 4;
static constexpr int BULLET_WIDTH = 3;
static constexpr int ARROW_SPEED = 2;
static constexpr int SPARKS_ANIM_SPEED = 3;
static constexpr int NO_PIXEL_FOUND = 60000; // special return value for SearchForPixelColorAlongBulletRay() when no color is found
union
{
unsigned char CurrentBulletSpeed; // the current speed (which could be null on the first frame)
unsigned char SparksAnimFrameId; // the frame id to play sparks when the bullet hit the wall
};
unsigned char GetWidth();
void DrawBulletRay(unsigned char color);
int SearchForPixelColorAlongBulletRay(unsigned char color);
};
#endif