added sphere bounce over the map borders

This commit is contained in:
2024-02-06 19:02:25 +01:00
parent 014209898f
commit c9a57142e7
10 changed files with 130 additions and 73 deletions

View File

@@ -26,7 +26,7 @@ func (position *Position) Update(x, y int, size ...int) {
position.Rect = &rect
}
func NewPosition(point *image.Point, cellsize int) *Position {
func NewPosition(point image.Point, cellsize int) *Position {
position := &Position{}
position.Update(point.X*cellsize, point.Y*cellsize, cellsize)
return position
@@ -39,8 +39,8 @@ func (position *Position) GetMoved(velosity *Velocity) *Position {
return pos
}
func (position *Position) Point() *image.Point {
return &image.Point{position.X / position.Cellsize, position.Y / position.Cellsize}
func (position *Position) Point() image.Point {
return image.Point{position.X / position.Cellsize, position.Y / position.Cellsize}
}
func (position *Position) Left() int {