Beispiel #1
0
        public void UpdateEnt(MapEnt e)
        {
            if (e == null)
                return;

            e.type = (string)enttypes.SelectedItem;
            e.data = new string[numprops];

            for (int i = 0; i < numprops; i++)
                e.data[i] = entprops[i].Text;
        }
Beispiel #2
0
        public void KeyPress(KeyEventArgs e)
        {
            if (CurEnt == null)
                return;

            int size = 1;	// number of pixels to move
            if ((Control.ModifierKeys & Keys.Shift) != 0)
                size = 10;

            switch (e.KeyCode) {
                case Keys.NumPad8: CurEnt.y -= size; break;
                case Keys.NumPad2: CurEnt.y += size; break;
                case Keys.NumPad4: CurEnt.x -= size; break;
                case Keys.NumPad6: CurEnt.x += size; break;

                case Keys.Delete: engine.map.Entities.Remove(CurEnt); CurEnt = null; break;
            }
        }
Beispiel #3
0
        public void UpdateDlg(MapEnt e)
        {
            if (e == null)
                return;

            int idx = Array.IndexOf(MapEnt.enttypes, e.type);
            if (idx == -1) {
                e.type = (string)enttypes.Items[0];
                enttypes.SelectedIndex = 0;
            } else
                enttypes.SelectedIndex = idx;

            int i = 0;
            do {
                if (e.data != null && i < e.data.Length)
                    entprops[i].Text = e.data[i];
                else
                    entprops[i].Text = "";
            } while (++i < numprops);
        }
Beispiel #4
0
        public void MouseClick(Point e, Input.MouseButton b)
        {
            int x = e.X + engine.XWin;
            int y = e.Y + engine.YWin;

            if ((Control.ModifierKeys & Keys.Shift) != 0) {
                // create a new entity
                MapEnt ent = new MapEnt();
                ent.type = "Ripper";
                ent.x = x;
                ent.y = y;

                engine.map.Entities.Add(ent);

                CurEnt = ent;
            } else {
                MapEnt ent = FindEnt(x, y);

                if (ent == null)
                    return;

                CurEnt = ent;
            }
        }
Beispiel #5
0
    void SpawnEntity(MapEnt e)
    {
        // ew.

        switch (e.type) {
            case "player":
                // Only applies when the game starts on this map.
                player.X = e.x;
                player.Y = e.y;
                break;

            case "door":
                SpawnEntity(new Entities.Door(this,
                                                  e.x, e.y, 		// door position
                                                  Dir.left, 		// direction?
                                                  e.data[0],		// dest map
                                                  Convert.ToInt32(e.data[1]),		// dest X
                                                  Convert.ToInt32(e.data[2])));		// dest Y
                break;

            case "ripper":
                SpawnEntity(new Entities.Enemies.Ripper(this, e.x, e.y));
                break;

            case "hopper":
                SpawnEntity(new Entities.Enemies.Hopper(this, e.x, e.y));
                break;

            default:
                throw new System.Exception(String.Format("Engine::MapSwitch Unknown entity type {0}", e.type));
        }
    }