examples/drag/main.go
func (s *Sprite) MoveBy(x, y int) {
	w, h := s.image.Size()

	s.x += x
	s.y += y
	if s.x < 0 {
		s.x = 0
	}
	if s.x > screenWidth-w {
		s.x = screenWidth - w
	}
	if s.y < 0 {
		s.y = 0
	}
	if s.y > screenHeight-h {
		s.y = screenHeight - h
	}
}
func (s *Sprite) MoveBy(x, y int) {
	w, h := s.image.Size()

	s.x += x
	s.y += y
	if s.x < 0 {
		s.x = 0
	}
	if s.x > screenWidth-w {
		s.x = screenWidth - w
	}
	if s.y < 0 {
		s.y = 0
	}
	if s.y > screenHeight-h {
		s.y = screenHeight - h
	}
}
func ( s * Sprite ) MoveBy ( x , y int ) { w , h := s . image . Size ( ) s . x += x s . y += y if s . x < 0 { s . x = 0 } if s . x > screenWidth - w { s . x = screenWidth - w } if s . y < 0 { s . y = 0 } if s . y > screenHeight - h { s . y = screenHeight - h } }
// MoveBy moves the sprite by (x, y).
MoveBy moves the sprite by ( x y ) .