From d4491a9ec2a1a5befcaac962aeca44cace6afec8 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 14 Jan 2016 17:13:07 -0800 Subject: [PATCH] added dice icon back to dice.js script --- examples/dice.js | 59 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/examples/dice.js b/examples/dice.js index ee88984b75..29b522f16b 100644 --- a/examples/dice.js +++ b/examples/dice.js @@ -33,11 +33,11 @@ var BUTTON_SIZE = 32; var PADDING = 3; Script.include(["libraries/toolBars.js"]); -var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function (screenSize) { - return { - x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING), - y: (screenSize.y - (BUTTON_SIZE + PADDING)) - }; +var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function(screenSize) { + return { + x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING), + y: (screenSize.y - (BUTTON_SIZE + PADDING)) + }; }); var offButton = toolBar.addOverlay("image", { width: BUTTON_SIZE, @@ -65,12 +65,13 @@ var deleteButton = toolBar.addOverlay("image", { alpha: 1 }); +var diceIconURL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/images/dice.png" var diceButton = toolBar.addOverlay("image", { x: screenSize.x / 2 + PADDING, y: screenSize.y - (BUTTON_SIZE + PADDING), width: BUTTON_SIZE, height: BUTTON_SIZE, - imageURL: HIFI_PUBLIC_BUCKET + "images/die.png", + imageURL: diceIconURL, color: { red: 255, green: 255, @@ -79,6 +80,7 @@ var diceButton = toolBar.addOverlay("image", { alpha: 1 }); + var GRAVITY = -3.5; // NOTE: angularVelocity is in radians/sec @@ -90,28 +92,27 @@ function shootDice(position, velocity) { Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG); } else { for (var i = 0; i < NUMBER_OF_DICE; i++) { - dice.push(Entities.addEntity( - { - type: "Model", - modelURL: HIFI_PUBLIC_BUCKET + "models/props/Dice/goldDie.fbx", - position: position, - velocity: velocity, - rotation: Quat.fromPitchYawRollDegrees(Math.random() * 360, Math.random() * 360, Math.random() * 360), - angularVelocity: { - x: Math.random() * MAX_ANGULAR_SPEED, - y: Math.random() * MAX_ANGULAR_SPEED, - z: Math.random() * MAX_ANGULAR_SPEED - }, - gravity: { - x: 0, - y: GRAVITY, - z: 0 - }, - lifetime: LIFETIME, - shapeType: "box", - collisionsWillMove: true, - collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav" - })); + dice.push(Entities.addEntity({ + type: "Model", + modelURL: HIFI_PUBLIC_BUCKET + "models/props/Dice/goldDie.fbx", + position: position, + velocity: velocity, + rotation: Quat.fromPitchYawRollDegrees(Math.random() * 360, Math.random() * 360, Math.random() * 360), + angularVelocity: { + x: Math.random() * MAX_ANGULAR_SPEED, + y: Math.random() * MAX_ANGULAR_SPEED, + z: Math.random() * MAX_ANGULAR_SPEED + }, + gravity: { + x: 0, + y: GRAVITY, + z: 0 + }, + lifetime: LIFETIME, + shapeType: "box", + collisionsWillMove: true, + collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav" + })); position = Vec3.sum(position, Vec3.multiply(DIE_SIZE, Vec3.normalize(Quat.getRight(Camera.getOrientation())))); } } @@ -150,4 +151,4 @@ function scriptEnding() { } Controller.mousePressEvent.connect(mousePressEvent); -Script.scriptEnding.connect(scriptEnding); +Script.scriptEnding.connect(scriptEnding); \ No newline at end of file