Skip to content

Commit

Permalink
修正aoi根据坐标获取格子ID x,y写错问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aceld committed May 31, 2019
1 parent 966f1f8 commit 17336c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zinx_app_demo/mmo_game/core/aoi.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 129,7 @@ func (m *AOIManager) GetSurroundGridsByGid(gID int) (grids []*Grid) {
//通过横纵坐标获取对应的格子ID
func (m *AOIManager) GetGidByPos(x, y float32) int {
gx := (int(x) - m.MinX) / m.gridWidth()
gy := (int(x) - m.MinY) / m.gridLength()
gy := (int(y) - m.MinY) / m.gridLength()

return gy*m.CntsX gx
}
Expand Down

0 comments on commit 17336c7

Please sign in to comment.