コード例 #1
0
        public void OnKeyDown(object sender, KeyEventArgs e)
        {
            SpriteObject sobj = Sprite as SpriteObject;

            if (e.Key == KeyForward)
            {
                currentAccel = Acceleration;
                if (sobj != null)
                {
                    sobj.FlipHorizontal = false;
                }
            }
            if (e.Key == KeyBackward)
            {
                currentAccel = -Acceleration;
                if (sobj != null)
                {
                    sobj.FlipHorizontal = true;
                }
            }
            if (e.Key == KeyBreak)
            {
                breaking     = true;
                currentAccel = new Vector(0, 0);
            }
        }
コード例 #2
0
        public void OnKeyDown(object sender, KeyEventArgs e)
        {
            SpriteObject sobj = Sprite as SpriteObject;

            if (e.Key == KeyJump)
            {
                loadJump = true;
            }
        }
コード例 #3
0
        public void selectImage(IGameObject sobj)
        {
            if (!(sobj is SpriteObject))
            {
                return;
            }
            SpriteObject obj = sobj as SpriteObject;

            String fullpath = "";
            String relpath  = "";

            try
            {
                OpenFileDialog dlgOpen = new OpenFileDialog();
                dlgOpen.Filter = "png|*.png|jpeg|*.jpg";
                if (dlgOpen.ShowDialog() == DialogResult.OK)
                {
                    fullpath = dlgOpen.FileName;
                    relpath  = Helper.DataDir + "\\" + dlgOpen.SafeFileName;
                }
                if (!Directory.Exists(Helper.DataLocalPath))
                {
                    Directory.CreateDirectory(Helper.DataLocalPath);
                }
                try
                { File.Copy(fullpath, Helper.AssemblyLocalPath + "\\" + relpath, true); }
                catch (Exception ex) { /*MessageBox.Show(ex.Message); */ Debug.WriteLine("selectImage[copy] ==> " + ex.Message); }
                obj.ImagePath = relpath;
                obj.loadFromImagePath();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Error in File Selection SpriteObject " + obj.Name + ":\n" + ex.Message);
                Trace.WriteLine("LevelSet Load Fehler");
            }
        }