diff --git a/docs/pages/tutorials/emojimon/a-wild-emojimon-appears.mdx b/docs/pages/tutorials/emojimon/a-wild-emojimon-appears.mdx index eddc3bd498..33f3c9b2e8 100644 --- a/docs/pages/tutorials/emojimon/a-wild-emojimon-appears.mdx +++ b/docs/pages/tutorials/emojimon/a-wild-emojimon-appears.mdx @@ -150,8 +150,8 @@ function spawn(uint32 x, uint32 y) public { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; bytes32 position = positionToEntityKey(x, y); require(!Obstruction.get(position), "this space is obstructed"); @@ -187,8 +187,8 @@ function move(uint32 x, uint32 y) public { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; Position.set(player, x, y); @@ -229,8 +229,8 @@ function move(uint32 x, uint32 y) public { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; Position.set(player, x, y); diff --git a/docs/pages/tutorials/emojimon/map-and-terrain.mdx b/docs/pages/tutorials/emojimon/map-and-terrain.mdx index 3a732082be..7f3880be98 100644 --- a/docs/pages/tutorials/emojimon/map-and-terrain.mdx +++ b/docs/pages/tutorials/emojimon/map-and-terrain.mdx @@ -294,8 +294,8 @@ contract MapSystem is System { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; bytes32 position = positionToEntityKey(x, y); require(!Obstruction.get(position), "this space is obstructed"); @@ -317,8 +317,8 @@ contract MapSystem is System { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; Position.set(player, x, y); } @@ -449,8 +449,8 @@ function move(uint32 x, uint32 y) public { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; Position.set(player, x, y); } @@ -465,8 +465,8 @@ function spawn(uint32 x, uint32 y) public { // Constrain position to map size, wrapping around if necessary (uint32 width, uint32 height, ) = MapConfig.get(); - x = x + (width % width); - y = y + (height % height); + x = (x + width) % width; + y = (y + height) % height; Player.set(player, true); Position.set(player, x, y);