Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var AnswerTrigger = function(opts) {
AnswerTrigger.superclass.constructor.call(this, opts);
this.getBoolean('correctness', opts, 'correct', 'incorrect');
// Listen for when a question is answered
events.addListener(SS.eventRelay, 'answerQuestionTrigger', this.handle.bind(this));
}
AnswerTrigger.inherit(SS.Trigger, {
// Add sprites to the roadsides
this.populateRoadSide(1);
this.populateRoadSide(-1);
// Ghost cars representing medal cutoffs
// TODO: Make seperate class, support lines in addition to cars
this.medalCars = [];
var names = ['Gold', 'Silver', 'Bronze']
var hacks = ['goldZ', 'silverZ', 'bronzeZ']
for(var i=0; i<3; i+= 1) {
opts['content'] = new cocos.nodes.Sprite({file: '/resources/Cars/car'+names[i]+'01.png'});
this.medalCars[i] = new PNode(opts)
this.medalCars[i].zVelocity = RC.finishLine / RC.times[i+1];
events.addListener(this.medalCars[i], 'addMe', this.addMeHandler);
events.addListener(this.medalCars[i], 'removeMe', this.removeMeHandler);
this.medalCars[i].delOnDrop = false;
//HACK: Should be a cleaner way of doing this instead of a straight bypass
this.medalCars[i].dash = this.dash;
this.medalCars[i].dashStr = hacks[i];
//ENDHACK
}
if(!this.skipSplash) {
this.splash = new SplashScreen(['/resources/splash.png']);
events.addListener(this.splash, 'splashScreensCompleted', this.splashCallback.bind(this));;
this.splash.zOrder = 110;
this.addChild({child: this.splash});
this.splash.start();
}
else {
})();
// Setup the director
var director = cocos.Director.get('sharedDirector');
director.attachInView(document.getElementById('cocos_test_app'));
var scene = cocos.nodes.Scene.create(); // Create a scene
var app = FluencyApp.create(); // Create the layers
var menu = MenuLayer.create();
// Allow the App layer to directly access the UI layer
app.set('menuLayer', menu);
// Set up inter-layer events
events.addListener(app, 'loaded', menu.createMenu.bind(menu));
events.addListener(menu, 'startGameEvent', app.startGame.bind(app));
events.addListener(menu, 'muteAudioEvent', app.muteAudioHandler.bind(app));
events.addListener(menu, 'muteMusicEvent', app.muteMusicHandler.bind(app));
// Add our layers to the scene
scene.addChild({child: app});
scene.addChild({child: menu});
// Run the scene
director.runWithScene(scene);
};
fBound.prototype = new fNOP();
return fBound;
};
}
// Setup the director
var director = cocos.Director.get('sharedDirector');
director.attachInView(document.getElementById('cocos_test_app'));
var scene = cocos.nodes.Scene.create(); // Create a scene
var app = FluencyApp.create(); // Create the layers
var menu = MenuLayer.create();
// Set up inter-layer events
events.addListener(app, 'loaded', menu.createMenu.bind(menu));
events.addListener(menu, 'startGameEvent', app.countdown.bind(app));
events.addListener(menu, 'muteAudioEvent', app.muteAudioHandler.bind(app));
events.addListener(menu, 'muteMusicEvent', app.muteMusicHandler.bind(app));
// Add our layers to the scene
scene.addChild({child: app});
scene.addChild({child: menu});
// Allow the App layer to directly access the UI layer
app.set('menuLayer', menu);
app.set('scene', scene);
// Run the scene
director.runWithScene(scene);
};
var IncludeTrigger = function(opts) {
IncludeTrigger.superclass.constructor.call(this, opts);
this.getOpt('path', opts);
events.addListener(eventRelay, 'IncludeTriggerEvent', this.handle.bind(this));
}
IncludeTrigger.inherit(Trigger, {
addMeHandler: function (toAdd) {
this.addChild({child: toAdd});
events.addListener(toAdd, 'removeMe', this.removeMeHandler);
},
triggerFloatText: function(amt) {
var color = '#009900'
var prefix = '+';
if(amt < 0) {
color = '#CC0000'
prefix = '';
}
var ft = FloatText.create({string: prefix + amt, fontColor: color, fontSize: '34', fontName: MAC.font})
ft.set('position', new geo.Point(850, 585));
ft.set('zOrder', 10);
events.addListener(ft, 'onFinish', this.removeFloatText);
this.addChild({child: ft});
},
scriptedBindings: function() {
events.addListener(ER, 'HideMedalCarEvent', this.scriptedHideMedalCar.bind(this));
events.addListener(ER, 'LockAbsoluteLaneEvent', this.scriptedLockAbsoluteLane.bind(this));
events.addListener(ER, 'LockVelocityEvent', this.scriptedLockVelocity.bind(this));
events.addListener(ER, 'RevertVelocityEvent', this.scriptedRevertVelocity.bind(this));
events.addListener(ER, 'SetAbsoluteLaneEvent', this.scriptedSetAbsoluteLane.bind(this));
events.addListener(ER, 'SetVelocityEvent', this.scriptedSetVelocity.bind(this));
events.addListener(ER, 'ShowMedalCarEvent', this.scriptedShowMedalCar.bind(this));
events.addListener(ER, 'StartTimerEvent', this.scriptedStartTimer.bind(this));
events.addListener(ER, 'StopTimerEvent', this.scriptedStopTimer.bind(this));
events.addListener(ER, 'UnlockAbsoluteLaneEvent', this.scriptedUnlockAbsoluteLane.bind(this));
events.addListener(ER, 'UnlockVelocityEvent', this.scriptedUnlockVelocity.bind(this));
},
slideLabelIn: function (l, d) {
this.addChild({child: l});
var a = new cocos.actions.MoveTo({position: new geo.Point(15, l.position.y), duration: d});
a.startWithTarget(l);
l.runAction(a);
events.addListener(a, 'actionComplete', this._actionComplete);
},
totalLabelUp: function(label, link, value, duration) {
this.addChild({child: label});
var m = MOT.create(0, value, duration);
m.bind(this, link);
events.addListener(m, 'Completed', this._actionComplete);
},