more bug fixes

This commit is contained in:
bwent 2015-08-14 15:09:48 -07:00
parent 68fcf4ec8a
commit 7bd9e2653c
3 changed files with 14 additions and 20 deletions

View file

@ -20,7 +20,6 @@ Script.include('../utilities/tools/vector.js');
var URL = "https://s3.amazonaws.com/hifi-public/marketplace/hificontent/Scripts/planets/";
SatelliteCreator = function() {
print("initializing satellite game");
var MAX_RANGE = 50.0;
@ -291,9 +290,6 @@ SatelliteCreator = function() {
}
this.quitGame = function() {
if(!this.isActive) {
return;
}
print("ending satellite game");
this.isActive = false;

View file

@ -165,6 +165,7 @@ var rideButton = addImage(systemViewPanel, 'rocket');
var tweening, tweeningPaused;
Script.include('https://hifi-staff.s3.amazonaws.com/bridget/tween.js');
pauseButton.addAction('onClick', function() {
if (tweening) {
if (!tweeningPaused) {
@ -172,6 +173,7 @@ pauseButton.addAction('onClick', function() {
} else {
tweeningPaused = false;
}
return;
}
if (!paused) {
pause();
@ -183,13 +185,6 @@ pauseButton.addAction('onClick', function() {
// Allow to toggle pause with spacebar
function keyPressEvent(event) {
if (event.text == "SPACE") {
if (tweening) {
if (!tweeningPaused) {
tweeningPaused = true;
} else {
tweeningPaused = false;
}
}
if (!paused) {
pause();
} else {
@ -214,13 +209,11 @@ rideButton.addAction('onClick', function() {
tweening = true;
tweeningPaused = false;
}
});
restartButton.addAction('onClick', function() {
restart();
tweening = false;
});
var zoomPanel = addPanel({

View file

@ -21,9 +21,8 @@
CreateSimulation = function() {
Script.include("https://hifi-public.s3.amazonaws.com/eric/scripts/tween.js");
Script.include('games/satellite.js');
trailsEnabled = true;
var trailsEnabled = this.trailsEnabled = true;
var DAMPING = this.DAMPING = 0.0;
var LIFETIME = this.LIFETIME = 6000;
@ -127,6 +126,9 @@ CreateSimulation = function() {
}
this.pause = function() {
if(paused) {
return;
}
for (var i = 0; i < planets.length; ++i) {
Entities.editEntity(planets[i].planet, {
velocity: {
@ -142,6 +144,9 @@ CreateSimulation = function() {
}
this.resume = function() {
if(!paused) {
return;
}
for (var i = 0; i < planets.length; ++i) {
planets[i].label.hide();
}
@ -216,18 +221,15 @@ CreateSimulation = function() {
this.clearTrails = function() {
elapsed = 0.0;
for (var j = 0; j < this.lineStack.length; ++j) {
Entities.editEntity(this.lineStack[j], {
visible: false
});
}
}
this.resetTrails = function() {
elapsed = 0.0;
this.trail = [];
this.lineStack = [];
//add the first line to both the line entity stack and the trail
@ -488,12 +490,15 @@ CreateSimulation = function() {
elapsed = 0.0;
planets.length = 0;
initPlanets();
MyAvatar.position = startingPosition;
Camera.setPosition(cameraStart);
};
}
CreateSimulation();
Script.update.connect(update);
Script.scriptEnding.connect(scriptEnding);
Script.scriptEnding.connect(scriptEnding);