Last active
May 27, 2019 05:20
-
-
Save anchetaWern/12cf212c720ae94b23645f449c0d34e3 to your computer and use it in GitHub Desktop.
React Native Accelerometer Maze: set up ball and goal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App.js | |
const BALL_SIZE = Math.floor(width * .02); | |
const ballStartPoint = GetRandomPoint(GRID_X, GRID_Y); | |
const theBall = Matter.Bodies.circle( | |
ballStartPoint.x, | |
ballStartPoint.y, | |
BALL_SIZE, | |
{ | |
label: "ball" | |
} | |
); | |
const GOAL_SIZE = Math.floor(width * .04); | |
const goalPoint = GetRandomPoint(GRID_X, GRID_Y); | |
const goal = Matter.Bodies.rectangle(goalPoint.x, goalPoint.y, GOAL_SIZE, GOAL_SIZE, { | |
isStatic: true, | |
isSensor: true, | |
label: 'goal' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment