nothing important
uhm just putting a newer version online.
This commit is contained in:
parent
b1458e2725
commit
7d5fdfa0ea
4 changed files with 30 additions and 22 deletions
32
src/fairy.c
32
src/fairy.c
|
@ -46,15 +46,25 @@ void delete_fairy(Fairy *fairy) {
|
|||
|
||||
void draw_fairy(Fairy *f) {
|
||||
glPushMatrix();
|
||||
float s = sin((float)global.frames/10.0f)/4.0f+1.3f;
|
||||
glTranslatef(f->x, f->y,0);
|
||||
glScalef(s, s, s);
|
||||
glRotatef(global.frames*10,0,0,1);
|
||||
glColor3f(0.5,0.8,1);
|
||||
draw_texture(0, 0, &global.textures.fairy_circle);
|
||||
glColor3f(1,1,1);
|
||||
glPushMatrix();
|
||||
float s = sin((float)global.frames/10.0f)/4.0f+1.3f;
|
||||
glScalef(s, s, s);
|
||||
glRotatef(global.frames*10,0,0,1);
|
||||
glColor3f(0.5,0.8,1);
|
||||
draw_texture(0, 0, &global.textures.fairy_circle);
|
||||
glColor3f(1,1,1);
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
if(f->dir)
|
||||
glScalef(-1,1,1);
|
||||
draw_animation(0, 0, f->moving, f->ani);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
draw_animation(f->x, f->y, f->moving, f->ani);
|
||||
}
|
||||
|
||||
void free_fairies() {
|
||||
|
@ -64,17 +74,11 @@ void free_fairies() {
|
|||
void process_fairies() {
|
||||
Fairy *fairy = global.fairies, *del = NULL;
|
||||
|
||||
// while(fairy != NULL) {
|
||||
// printf("%d <- %d -> %d\n", fairy->prev, fairy, fairy->next);
|
||||
// fairy = fairy->next;
|
||||
// }
|
||||
// printf("=================\n");
|
||||
|
||||
fairy = global.fairies;
|
||||
while(fairy != NULL) {
|
||||
fairy->rule(fairy);
|
||||
|
||||
if(fairy->x < -50 || fairy->x > VIEWPORT_W + 50 || fairy->y < -50 || fairy->y > VIEWPORT_H + 50 || fairy->hp <= 0) {
|
||||
if(fairy->x < -20 || fairy->x > VIEWPORT_W + 20 || fairy->y < -20 || fairy->y > VIEWPORT_H + 20 || fairy->hp <= 0) {
|
||||
del = fairy;
|
||||
fairy = fairy->next;
|
||||
delete_fairy(del);
|
||||
|
|
|
@ -32,17 +32,17 @@ typedef struct Fairy {
|
|||
struct Fairy *prev;
|
||||
|
||||
int birthtime;
|
||||
int hp;
|
||||
char hp;
|
||||
|
||||
int x, y;
|
||||
int sx, sy;
|
||||
int angle;
|
||||
int v;
|
||||
char angle;
|
||||
char v;
|
||||
|
||||
char moving;
|
||||
char dir;
|
||||
|
||||
Animation *ani;
|
||||
Animation *ani;
|
||||
|
||||
FairyRule rule;
|
||||
} Fairy;
|
||||
|
|
|
@ -135,8 +135,11 @@ next0:
|
|||
glTexCoord2f(0,hq); glVertex2f(-1, 1);
|
||||
glTexCoord2f(wq,hq); glVertex2f(1, 1);
|
||||
glTexCoord2f(wq,0); glVertex2f(1, -1);
|
||||
|
||||
glColor3fv((float *)&proj->clr);
|
||||
glEnd();
|
||||
|
||||
glColor3fv((float *)&proj->clr);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(wq,0); glVertex2f(-1, -1);
|
||||
glTexCoord2f(wq,hq); glVertex2f(-1, 1);
|
||||
glTexCoord2f(2*wq,hq); glVertex2f(1, 1);
|
||||
|
|
|
@ -31,8 +31,8 @@ void simpleFairy(Fairy *f) {
|
|||
|
||||
create_projectile(&_projs.rice, f->x, f->y, 180, ((Color){0,0,1}), simple, 2);
|
||||
}
|
||||
f->moving = 0;
|
||||
f->dir = 1;
|
||||
f->moving = 1;
|
||||
f->dir = f->v < 0;
|
||||
|
||||
f->x += f->v;
|
||||
f->y = sin((global.frames-f->birthtime)/10.0f)*20+f->sy;
|
||||
|
@ -87,6 +87,7 @@ void stage0_events() {
|
|||
// create_projectile(&_projs.ball, i*VIEWPORT_W/15, 0, 180, ((Color) {0,0,1}), simple, 2);
|
||||
create_fairy(0, 100, 1, 180, 2, simpleFairy);
|
||||
create_fairy(VIEWPORT_W-1, 10, -1, 180, 3, simpleFairy);
|
||||
create_fairy(VIEWPORT_W-1, 200, -1, 180, 3, simpleFairy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue