ogre monster (crappy version)

i made something in gscript for the first time in a year. it’s retarded and buggy as hell, but i thought i should still show everyone :slight_smile: sometime soon it will be baddass.


if (created) {
  // Initialize the attributes
  showcharacter;
  setcharprop #3,head0.png;
  setcharprop #C0,orange;
  setcharprop #C1,white;
  setcharprop #C2,blue;
  setcharprop #C3,red;
  setcharprop #C4,black;
  setcharprop #2,shield1.gif;
  shieldpower = 1;
  dir = 2;
  this.mode = 0;
  this.px = 0;
  this.py = 0;
  timeout = .05;
  this.speed = .9;
}

if (timeout)
  {
  if (this.mode==0)
    {
    if (dir==0)
      {
      if (playerx>x-3 && playerx<x+3 && playery<y) {this.mode = 1;this.py = playery-1;}
      else dir++;
    }
    if (dir==1)
      {
      if (playery>y-3 && playery<y+3 && playerx<x) {this.mode = 1;this.px = playerx;}
      else dir++;
    }
    if (dir==2)
      {
      if (playerx>x-3 && playerx<x+3 && playery>y) {this.mode = 1;this.py = playery+1;}
      else dir++;
    }
    if (dir==3)
      {
      if (playery>y-3 && playery<y+3 && playerx>x) {this.mode = 1;this.px = playerx;}
      else dir=0;
    }
  }
  if (this.mode==1)
    {
    message I see you!;
    setcharani walk,;
    if (dir==0)
      {
      if (playery>y-4 && playery>y && playerx>=x-5 && playerx<=x+5) {thix.py = playery; this.mode = 2;}
      else {y-=this.speed;}
    }
    if (dir==1)
      {
      if (playerx>x-4 && playerx<x && playery>=y-5 && playery<=y+5) {this.px = playerx;this.mode = 2;}
      else {x-=this.speed;}
    }
    if (dir==2)
      {
      if (playery<y+4 && playery>y && playerx>=x-5 && playerx<=x+5) {this.py = playery; this.mode = 2;}
      else {y+=this.speed;}
    }
    if (dir==3)
      {
      if (playerx<x+4 && playerx>x && playery>=y-5 && playery<=y+5) {this.px = playerx;this.mode = 2;}
      else {x+=this.speed;}
    }
  }
  if (this.mode==2)
    {
    message Boom Time!;
    freezeplayer .05;

    if (dir==0)
      {
      if (!onwall(x + 0.5,y + 0.5) && !onwall(x + 1,y + 0.5) && !onwall(x + 1.5,y + 0.5))
        {
        playery=this.py;
        this.py-=this.speed;
        y-=this.speed;
      }
      else {hurt 1; setcharani hurt,;sleep 1;this.mode = 0;}
    }




    if (dir==1)
      {
      if (!onwall(x - 0.5,y + 1) && !onwall(x - 0.5,y + 2))
        {
        playerx=this.px;
        this.px-=this.speed;
        x-=this.speed;
      }
      else {hurt 1; setcharani hurt,;sleep 1;this.mode = 0;}
    }

    if (dir==2)
      {
      if (!onwall(x + 0.5,y + 3) && !onwall(x + 1,y + 3) && !onwall(x + 1.5,y + 3))
        {
        playery=this.py;
        this.py+=this.speed;
        y+=this.speed;
      }
      else {hurt 1; setcharani hurt,;sleep 1;this.mode = 0;}
    }
    if (dir==3)
      {
      if (!onwall(x + 2.5,y + 1) && !onwall(x + 2.5,y + 2))
        {
        playerx=this.px;
        this.px+=this.speed;
        x+=this.speed;
      }
      else {hurt 1; setcharani hurt,;sleep 1;this.mode = 0;}
    }
  }
  timeout = .05;
}

yay for this shit

suppose to grab you and run you into a wall. like in l4d

CHARGER!!!

yeah that thing. dunno how im gonna make it look as sweet as that though

We bother riley til he makes it

i doubt riley will do me any favors

Hosler, I thought you were better then this… WHAT IS THE WORLD COMMING TO!!

I wrote that shit in like ten minutes. Tested it out once. I decided to organize it in states, which I have never done before.

Sent from my MB860 using Tapatalk

Thats pretty decent for 10 mins then :0

Ok trixta. Im drunk as shit right now, but im gonna do my best to impress you when im done with it. Keep in mind that im an engineer. So my coding will be sloppy but will get the job done. Lol I dunno why I said I was drunk.

I love you riley. Please be my friend.

Sent from my MB860 using Tapatalk

Your a software engineer? Im studying become one and I try to have my code as compact as possible o.0

No! Im a computer engineer!

Sent from my MB860 using Tapatalk

:0 that explains it all lol, arnt you trained to work in procedural based languages?

Just took a class in verilog. That ogre script is almost an fsm

Sent from my MB860 using Tapatalk