Skip to content

Instantly share code, notes, and snippets.

@anchetaWern
Last active May 27, 2019 05:20
Show Gist options
  • Save anchetaWern/12cf212c720ae94b23645f449c0d34e3 to your computer and use it in GitHub Desktop.
Save anchetaWern/12cf212c720ae94b23645f449c0d34e3 to your computer and use it in GitHub Desktop.
React Native Accelerometer Maze: set up ball and goal
// 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