taisei/src/plrmodes.c
laochailan bdc0db9957 merged Slave and Fairy to Enemy
To create a slave, pass ENEMY_IMMUNE for hp in create_enemy(). tip: create_enemyg(...) is an abbreviation for create_enemy(&global.enemies, ...).
There is something like a super fancy event system for Enemies' logic rules now: logic_rule will be called with t = negative special values like EVENT_BIRTH or EVENT_DEATH on corresponding events. cool, isn't it? well those values have to be filtered out (like if(t < 0) return;) if you don't use them so they don't do strange things with your locus.
2011-04-26 12:04:45 +02:00

35 lines
No EOL
850 B
C

/*
* This software is licensed under the terms of the MIT-License
* See COPYING for further information.
* ---
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
*/
#include "plrmodes.h"
#include "player.h"
#include "global.h"
void youmu_opposite_draw(Enemy *e, int t) {
complex pos = e->pos + ((Player *)e->parent)->pos;
draw_texture(creal(pos), cimag(pos), "items/power");
}
void youmu_opposite_logic(Enemy *e, int t) {
if(t < 0)
return;
Player *plr = (Player *)e->parent;
if(plr->focus < 15) {
e->args[1] = carg(plr->pos - e->pos0);
e->pos = e->pos0 - plr->pos;
if(cabs(e->pos) > 30)
e->pos -= 5*cexp(I*carg(e->pos));
}
if(plr->fire && !(global.frames % 4))
create_projectile("youmu", e->pos + plr->pos, ((Color){1,1,1}), linear, -20*cexp(I*e->args[1]))->type = PlrProj;
e->pos0 = e->pos + plr->pos;
}