private void Add() { var a = ImageObject.FromFile(@"C:\frice.png", Mouse.X - 50, Mouse.Y - 50, 100, 100); a.MoveList.Add(new SimpleMove(100, -400)); a.MoveList.Add(new AccelerateMove(0, 1000)); AddObject(a); }
public override void OnInit() { ShowFps = true; AddObject(ImageObject.FromFile("back.png", 0, 0)); Height = 500; Width = 400; _bird = ImageObject.FromFile("an.png", 20, 300); _score = new TextObject(ColorResource.Black, "Click to jump.", 16, 10, 20); ResetGravity(); _lambda = () => { _bird.Y = 200; _bird.ClearAnims(); ResetGravity(); MessageBox.Show(@"GG!"); _score.Text = "Restart!"; _s = 0; }; foreach (var o in _lo) { _bird.TargetList.Add(new Pair <PhysicalObject, Action>(o, _lambda)); } foreach (var o in _lou) { _bird.TargetList.Add(new Pair <PhysicalObject, Action>(o, _lambda)); } AddObject(_bird, _score); _timer = new FTimeListener(1700, () => { _score.Text = "Score: " + _s++; _lou[_louLast].ClearAnims(); _lo[_loLast].ClearAnims(); _lou[_louLast].Y = H2; _lo[_loLast].Y = H1; _loLast = Random.Next(_lo.Length); _louLast = Random.Next(_lou.Length); var delta = Random.Next(50) - 50; _lou[_louLast].X = 550; _lo[_loLast].X = 550; _lou[_louLast].Y += delta; _lo[_loLast].Y += delta; _lou[_louLast].AddAnims(new SimpleMove(-400, 0)); _lo[_loLast].AddAnims(new SimpleMove(-400, 0)); AddObject(_lo[_loLast], _lou[_louLast]); }, true); AddTimeListener(_timer); base.OnInit(); }
public override void OnInit() { SetBounds(300, 300, 800, 600); SetTitle("F**k the world"); //replace with a file path in desk var b = ImageObject.FromFile(@"C:\frice.png", 300, 400, 50, 50); // var c = ImageObject.FromWeb("https://avatars1.githubusercontent.com/u/21008243", 400, 300); //can resize: // c.Height = 100; // c.Width = 100; b.MoveList.Add(new SimpleMove(-10, -10)); // c.MoveList.Add(new SimpleMove(-10, 10)); AddObject(b); AddObject(new SimpleText(ColorResource.高坂穗乃果, "Hello World", 10, 10)); // AddObject(c); }
public override void OnClick(double x, double y, int b) { FObject a; switch (b) { case 0: a = _x.Clone(); break; case 2: a = ImageObject.FromFile(@"C:\frice.png", 0, 0, 100, 100); break; default: a = new ShapeObject(ColorResource.DrakGray, new FCircle(50.0), 0, 0); break; } a.SetCentre(x, y); a.AddAnims(new SimpleMove(30, -500)); a.AddAnims(new AccelerateMove(0, 800)); AddObject(a); }