Skip to content

Commit 3dce769

Browse files
committed
Initial commit
0 parents  commit 3dce769

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4174
-0
lines changed

CAlien.cpp

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#include "CAlien.h"
2+
3+
4+
5+
int CAlien::mRallyPointX;
6+
7+
8+
9+
CAlien::CAlien() :CAnimate()
10+
{
11+
mAbsVelocity = 0;
12+
}
13+
14+
void CAlien::SetVelocity(int v)
15+
{
16+
mAbsVelocity = abs(v);
17+
CAnimate::SetVelocity(v);
18+
}
19+
20+
void CAlien::Move()
21+
{
22+
if (mActive)
23+
{
24+
if (mState == 1)
25+
{
26+
if (mXPos<=mRallyPointX && mVelocity<0)
27+
{
28+
SetVelocity(mAbsVelocity);
29+
Start(2, true);
30+
}
31+
else if (mXPos>=mRallyPointX && mVelocity>0)
32+
{
33+
Start(1, true);
34+
SetVelocity(-1 * mAbsVelocity);
35+
}
36+
CAnimate::Move();
37+
}
38+
39+
}
40+
41+
}
42+
43+
void CAlien::Transition()
44+
{
45+
if (mState == 0)
46+
{
47+
SetMoverState(true);
48+
mState = 1;
49+
mActive = true;
50+
if (mXPos<mRallyPointX && mVelocity>0)
51+
{
52+
SetVelocity(-1 * mAbsVelocity);
53+
Start(1, true);
54+
}
55+
else if (mXPos>mRallyPointX && mVelocity<0)
56+
{
57+
Start(2, true);
58+
SetVelocity(mAbsVelocity);
59+
}
60+
}
61+
else if (mState == 1)
62+
{
63+
}
64+
else if (mState == 2)
65+
{
66+
Reset();
67+
MoveOffScreen();
68+
}
69+
}
70+

CAlien.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
3+
#include "CAnimate.h"
4+
5+
class CAlien :public CAnimate
6+
{
7+
8+
public:
9+
static int mRallyPointX;
10+
int mAbsVelocity;
11+
12+
CAlien();
13+
14+
void SetVelocity(int v);
15+
16+
void Move();
17+
18+
void Transition();
19+
20+
};
21+

0 commit comments

Comments
 (0)