コード例 #1
0
ファイル: APPshrl.cs プロジェクト: kubazz/SHTerminal
    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);
        }
    }
コード例 #2
0
ファイル: APPshrl.cs プロジェクト: kubazz/SHTerminal
    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;
            }
        }
    }
コード例 #3
0
ファイル: APPshrl.cs プロジェクト: kubazz/SHTerminal
    void LoadLevel(string levelName)
    {
        string levelString = SHGUI.current.GetASCIIartByName(levelName);

        level = new int[levelWidth * levelHeight];

        int x = 0;
        int y = 0;

        for (int i = 0; i < levelString.Length; ++i)
        {
            if (levelString[i] == '\n')
            {
                x = 0;
                y++;
                continue;
            }

            if (levelString[i] == '#')
            {
                SetTile(1, x, y);
            }
            else if (levelString[i] == '.')
            {
                SetTile(2, x, y);
            }
            else if (levelString[i] == '=')
            {
                SetTile(3, x, y);
            }
            else if (levelString[i] == 'G')
            {
                var e = new SHRLenemy(this, x, y);
                e.item = new SHRLgun(this, x, y);
                (e.item as SHRLgun).SetPistol();
                entities.Add(e);
                SetTile(0, x, y);
            }
            else if (levelString[i] == 'T')
            {
                var e = new SHRLenemy(this, x, y);
                e.item = new SHRLgun(this, x, y);
                (e.item as SHRLgun).SetPistol();
                e.SetHorizontal(false);
                entities.Add(e);
                SetTile(0, x, y);
            }
            else if (levelString[i] == 'F')
            {
                var e = new SHRLenemy(this, x, y);
                entities.Add(e);
                SetTile(0, x, y);
            }
            else if (levelString[i] == 'R')
            {
                var e = new SHRLenemy(this, x, y);
                entities.Add(e);
                e.SetHorizontal(false);
                SetTile(0, x, y);
            }
            else if (levelString[i] == 'g')
            {
                SHRLgun g = new SHRLgun(this, x, y);
                g.SetPistol();
                entities.Add(g);
            }
            else if (levelString[i] == '&')
            {
                SHRLitem g = new SHRLitem(this, x, y);
                g.SetThrowable();
                entities.Add(g);
            }
            else if (levelString[i] == '@')
            {
                player          = new SHRLenemy(this, x, y);
                player.color    = 'w';
                player.isPlayer = true;
                entities.Add(player);
                SetTile(0, x, y);
            }

            x++;
        }
    }