Exemplo n.º 1
0
    public bool Walk(int dirx, int diry)
    {
        int tile = app.GetTile(x + dirx, y + diry);

        if (tile != 1 && tile != 2 && tile != 3)
        {
            SHRLentity e = app.GetEntity(x + dirx, y + diry);
            if (e != null)
            {
                if (e is SHRLenemy)
                {
                    SHRLenemy E = e as SHRLenemy;
                    if (isPlayer)
                    {
                        E.Kill();
                        return(false);
                    }
                    else
                    {
                        if (E.isPlayer)
                        {
                            E.Kill();
                        }
                        return(false);
                    }
                }
            }

            x += dirx;
            y += diry;

            this.dirx = dirx;
            this.diry = diry;

            return(true);
        }
        else
        {
            app.AddEntity(new SHRLparticle(app, x + dirx, y + diry, "▓▒░▒▓", "rrrrr"));
            return(false);
        }
    }
Exemplo n.º 2
0
    public override void Update(int ticks)
    {
        SHRLentity e = app.GetEntity(x, y);

        if (e != null && !fading)
        {
            SHRLenemy E = (e as SHRLenemy);
            if (E != null && E.id != ownerid)
            {
                if (stunsOnContact || killsOnContact)
                {
                    E.Kill();
                    Stop();
                }
            }
        }

        if (flying && !fading)
        {
            SHRLitem I = app.GetShatterableItem(x, y, id);

            if (I != null)
            {
                I.Stop();
                this.Stop();
            }
            else
            {
                if (app.GetTile(x, y) == 3)
                {
                    this.Stop();
                    app.SetTile(0, x, y);
                }
            }
        }

        if (!fading)
        {
            flySpeedTimer--;
            if (flying && flySpeedTimer <= 0)
            {
                x += dirx;
                y += diry;

                traillenght++;
                if (traillenght > 3)
                {
                    traillenght = 3;
                }

                if (app.GetTile(x, y) == 1)
                {
                    Stop();
                }

                flySpeedTimer = flySpeed;
            }
        }
        else
        {
            traillenght--;
            if (traillenght < 0)
            {
                del = true;
            }
        }
    }
Exemplo n.º 3
0
 public void AddEntity(SHRLentity e)
 {
     entities.Add(e);
 }