protected override AliveObject create() { PictureBox heart = new PictureBox(); heart.SizeMode = PictureBoxSizeMode.AutoSize; heart.Image = _heartBitmap; int w = _heartBitmap.Width; int h = _heartBitmap.Height; heart.Size = new Size(w, h); AliveObject ao = new AliveObject(heart); return(ao); }
public void update(object source, EventArgs args) { for (int i = _isUse.Count - 1; i >= 0; i--) { AliveObject pic = _isUse[i]; pic.move(); Point location = pic.Picture.Location; if (location.X < 0 || location.X > GameLoop.LimitX || location.Y < 0 || location.Y > GameLoop.LimitY) { _isUse.RemoveAt(i); _form.Controls.Remove(pic.Picture); if (onExitForm != null) { onExitForm(this, EventArgs.Empty); } } } }
protected abstract void init(AliveObject pic, Point currentPosition);
protected override void init(AliveObject pic, Point currentPosition) { pic.init(currentPosition, rand.Next(-9, 7), -5); }