Skip to content

Commit

Permalink
fix: example snake (#4)
Browse files Browse the repository at this point in the history
Signed-off-by: Haoxiang Fei <[email protected]>
Co-authored-by: Haoxiang Fei <[email protected]>
  • Loading branch information
tonyfettes and tonyfettes authored Sep 5, 2024
1 parent e086263 commit 0cefb4d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions example/snake/game.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

let random : @random.RandomState = @random.init_state()
let random : @random.Rand = @random.new()

let fruit : @wasm4.Sprite = @wasm4.sprite(
b"\x00\xa0\x02\x00\x0e\xf0\x36\x5c\xd6\x57\xd5\x57\x35\x5c\x0f\xf0",
Expand All @@ -32,8 +32,8 @@ pub fn Game::new() -> Game {
frame_count: 0,
prev_gamepad: @wasm4.GamePad::default(),
fruit: Point::{
x: random.gen_int().abs() % 20,
y: random.gen_int().abs() % 20,
x: random.int(~limit=20),
y: random.int(~limit=20),
},
}
}
Expand All @@ -58,8 +58,8 @@ pub fn update(self : Game) -> Unit {
None => ()
}
self.fruit = Point::{
x: random.gen_int().abs() % 20,
y: random.gen_int().abs() % 20,
x: random.int(limit=20),
y: random.int(limit=20),
}
}
}
Expand Down

0 comments on commit 0cefb4d

Please sign in to comment.