blob: 383ddc7ecdb4f4a76b1868e5093cc348abf585d4 (
plain)
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
|
#include "enemy.h"
#include <wriggle/texturesdl.h>
#include <SDL/SDL_opengl.h>
Enemy::Enemy(const Vector2& initpos, std::vector<BulletPattern*>& stage_patterns) : patterns(stage_patterns) {
pos = initpos;
texture = new TextureSDL("textures/enemy.png");
}
void Enemy::update() {
}
void Enemy::draw() {
glPointSize(32.0);
glColor4f(1, 1, 1, 1);
glEnable(GL_TEXTURE_2D);
texture->bind();
glBegin(GL_POINTS);
glVertex2f(pos.x, pos.y);
glEnd();
glDisable(GL_TEXTURE_2D);
}
Enemy1::Enemy1(const Vector2& initpos, std::vector<BulletPattern*>& stage_patterns) : Enemy(initpos, stage_patterns) {
steps = 0;
patterns.push_back(new BulletPattern1(initpos));
}
void Enemy1::update() {
steps++;
if(steps == 180) {
patterns.push_back(new BulletPattern2(pos));
}
}
Enemy2::Enemy2(const Vector2& initpos, std::vector<BulletPattern*>& stage_patterns) : Enemy(initpos, stage_patterns) {
steps = 0;
}
void Enemy2::update() {
steps++;
if(steps == 660) {
patterns.push_back(new BulletPattern3(pos));
}
}
|