Skip to content

Commit

Permalink
Adding Space.CheckCellsWorld().
Browse files Browse the repository at this point in the history
Updating readme.
  • Loading branch information
SolarLune committed Jan 26, 2022
1 parent 34e1cd6 commit 115dcb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func Update() {

___

Welp, that's about it. If you want to see more info, feel free to examine the examples in the `examples` folder; the `worldPlatformer.go` example is particularly in-depth when it comes to movement and collision response.
Welp, that's about it. If you want to see more info, feel free to examine the examples in the `examples` folder; the `worldPlatformer.go` example is particularly in-depth when it comes to movement and collision response. You can run them by just calling `go run .` from the examples folder.

[You can check out the documentation here, as well.](https://pkg.go.dev/github.com/solarlune/resolv)

Expand Down
12 changes: 12 additions & 0 deletions space.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ func (sp *Space) CheckCells(x, y, w, h int, tags ...string) *Object {

}

// CheckCellsWorld checks the cells of the Grid with the given world coordinates.
// Internally, this is just syntactic sugar for calling Space.WorldToSpace() on the
// position and size given.
func (sp *Space) CheckCellsWorld(x, y, w, h float64, tags ...string) *Object {

sx, sy := sp.WorldToSpace(x, y)
cw, ch := sp.WorldToSpace(w, h)

return sp.CheckCells(sx, sy, cw, ch, tags...)

}

// UnregisterAllObjects unregisters all Objects registered to Cells in the Space.
func (sp *Space) UnregisterAllObjects() {

Expand Down

0 comments on commit 115dcb0

Please sign in to comment.