JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://examples.phaser.io/_site/phaser/phaser.2.4.3.min.js"></script>
JavaScript
var game = new Phaser.Game(800, 500, Phaser.CANVAS, "game", { preload: preload, create: create, update: update, render: render });
var graphics1, graphics2, paddle, paddleSprite, circle, rotationSpeed = 0.1, ballsGroup;
function preload() {
game.load.image("ball", "img/FastLim/balls.png");
}
function create() {
game.physics.startSystem(Phaser.Physics.ARCADE);
var hinttxt = game.add.text(30, 30, " use left and right arrow to move ", { font: "12px Arial", fill: "#FFFFFF", align: "center" });
graphics1 = game.add.graphics(game.world.centerX, game.world.centerY);
// Our first arc will be a line only
graphics1.lineStyle(8, 0xffffff);
graphics2 = game.add.graphics(game.world.centerX, game.world.centerY);
// Our first arc will be a line only
graphics2.lineStyle(8, 0xCD0000);
//drawing the arcs
circle = graphics1.arc(0, 0, 110, game.math.degToRad(0), game.math.degToRad(360), false);
paddle = graphics2.arc(0, 0, 110, game.math.degToRad(0), game.math.degToRad(45), false);
paddleSprite = game.add.sprite(0, 0);
game.physics.enable(paddleSprite, Phaser.Physics.ARCADE);
paddleSprite.anchor.set(0.5);
// Add the graphics to the sprite as a child
paddle.addChild(paddleSprite);
// drawRandomBalls();
keyboard = game.input.keyboard.createCursorKeys();
}
function update() {
Movements();
var coll = game.physics.arcade.overlap(paddle, ballsGroup, updateBallsCollected, null, this);
}
function render() {
game.debug.body(paddle);
}
function updateBallsCollected() {
}
function Movements() {
if...