Works offline but Online It can’t hurt you and you can’t hurt it?
[CODE]//#CLIENTSIDE
if (playerenters) {
this.maxhp=5;
this.hp=5;
this.restartime=50;
timeout=.1;
}
if (playerenters||timeout) {
this.aimplayer=getnearestplayer,5,5);
}
if (timeout){
showimg 1,@c@#v(this.hp)/#v(this.maxhp),x+1,y+2.5;
changeimgzoom 1,.7;
if (this.hp>0){
setcharani bomy_walk,;
this.aimx=players[this.aimplayer].x;
this.aimy=players[this.aimplayer].y;
for (i=0;i<=20;i++){
if (this.img<=5) {
if (this.img=5) {this.img=0;}
this.img+=1;
}
if (abs(this.aimy)>y){
if (!onwall(x,y+2)) {
dir=2;
this.dir=2;
y+=.02;
}
} else if (abs(this.aimy)<y){
if (!onwall(x,y-2.02;)) {
dir=0;
this.dir=0;
y-=.02;
}
}
if (abs(this.aimx)>x){
if (!onwall(x+2.02,y)){
dir=3;
this.dir=3;
x+=.02;
}
} elseif (abs(this.aimx)<x){
if (!onwall(x-.02,y)){
dir=1;
this.dir=1;
x-=.02;
}
}
bomy_hitplayer();
}
}
else {this.restart+=1;}
if (this.hp<1){
this.hp=0;
putleaps 3,x,y;
}
if (this.restart>=this.restarttime){
this.restart=0;
//this.hp=this.maxhp;
}
timeout=.1;
}
if (washit||wasshot||waspelt){
hide;
bomy_recoil();
timeout=.1;
show;
}
/* functions below for actions *
-
hitplayer//playerhit */
function bomy_hitplayer() {
//if (!strequals(#g,Paused)) {
if (playerx in |x-.5,x+.5| && playery in |y-1,y+1|) {
playerhearts-=1;
setani ,hurt;
freezeplayer .25;
player_recoil();
}
if (x+vecx(this.dir)*2=this.aimx && y+vecy(this.dir)*2=this.aimy) {
playerhearts-=1;
setani ,hurt;
freezeplayer .25;
player_recoil();
}
//}
}
function bomy_recoil() {
if (this.hp-1>0){
this.hp-=1;
npcx=0;
npcy=0;
if (playerdir=0) {
npcx=0;
npcy-=4;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
if (playerdir=1) {
npcx-=4;
npcy=0;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
if (playerdir=2) {
npcx=0;
npcy+=4;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
if (playerdir=3) {
npcx+=4;
npcy=0;
if(!onwall(x+1.5+npcx,y+2+npcy)){
x+=npcx; y+=npcy;
}
}
}
else {this.hp=0; putleaps 3,x-1,y-1; putleaps 1,x+1,y+1; putleaps 1,x,y; sleep .5; destroy;}
}
function player_recoil() {
newx=0;
newy=0;
if (this.dir=0) {
newy-=3.5;
newx=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
if (this.dir=1) {
newx-=3.5;
newy=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
if (this.dir=2) {
newy+=3.5;
newx=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
if (this.dir=3) {
newx+=3.5;
newy=0;
if(!onwall(playerx+1.5+newx,playery+2+newy)){
playerx+=newx; playery+=newy;
}
}
}[/CODE]