Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:secretrobotron/crunch

Conflicts:
	src/main.js
  • Loading branch information...
commit dcddfea1a786c5d9d18997d7e19aba19a7e3adcf 2 parents b8e7bb1 + cd04144
Bobby Richter secretrobotron authored
BIN  assets/images/plane.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 src/engine/loader.js
View
@@ -3,6 +3,16 @@ define(["engine/event"], function(Event){
var __currentPool = null;
var __dummyFunc = function(){};
+ var __audioAvailable = true;
+
+ try {
+ var testAudio = new Audio();
+ audio.load();
+ } catch (e) {
+ __audioAvailable = false;
+ }
+
+
function __loadItems(items, callback){
var toLoad = items.length,
loaded = 0,
@@ -46,6 +56,9 @@ define(["engine/event"], function(Event){
}
var Loader = {
+ IsAudioAvailable: function() {
+ return __audioAvailable;
+ },
Audio: function(url, callback){
callback = callback || __dummyFunc;
5 src/entities/plane.js
View
@@ -4,18 +4,19 @@ define(["engine/entity", "engine/game-logic", "components/sprite", "engine/sched
var SPRITE_JSON = JSON.parse(SPRITE_SRC);
return function(setupOptions){
- return;
setupOptions = setupOptions || {};
+ console.log("Size: " + setupOptions.size);
var entity = new Entity({
name: "plane",
+ families: setupOptions.families,
components: [
new SpriteComponent({
size: setupOptions.size,
sprite: SPRITE_JSON
}),
],
- families: setupOptions.families,
+ position: [0, 10, -70]
});
return entity;
10 src/entities/player.js
View
@@ -69,10 +69,12 @@ define(["engine/entity", "components/sprite", "engine/schedule", "text!sprites/p
return function(setupOptions){
- Loader.load(Loader.Audio("assets/audio/WilhelmScream.ogg"), function(audio){
- wilhelmCry = audio;
- });
-
+ if( Loader.IsAudioAvailable() ) {
+ Loader.load(Loader.Audio("assets/audio/WilhelmScream.ogg"), function(audio){
+ wilhelmCry = audio;
+ });
+ }
+
setupOptions = setupOptions || {};
var entity = new Entity({
19 src/main.js
View
@@ -23,7 +23,7 @@ require([ "engine/schedule", "engine/hud",
});
*/
- var cameraSpeedDistance = 0.0;
+ var cameraSpeedDistance = 0.2;
DebugCanvas.SetEnabled(false);
@@ -46,9 +46,12 @@ require([ "engine/schedule", "engine/hud",
GameLogic.AddGameObject(playerEntity);
scene.add(playerEntity);
- //var plane = new PlaneEntity({
- // size: 1,
- //});
+ var plane = new PlaneEntity({
+ size: 10,
+ families : ["Plane"]
+ });
+ GameLogic.AddGameObject(plane);
+ scene.add(plane);
GameLogic.EachFrame("Player").push( function(p, elapsedTime) {
DebugCanvas.Clear();
@@ -112,8 +115,12 @@ require([ "engine/schedule", "engine/hud",
var dx = e.data.dt / 300;
//scene.cubicvr.camera.position[0] += dx;
//scene.cubicvr.camera.target[0] += dx;
- scene.cubicvr.camera.target = [playerEntity.position[0],9, 0];
- scene.cubicvr.camera.position = [playerEntity.position[0], 14, 25];
+ //scene.cubicvr.camera.target = [playerEntity.position[0],9, 0];
+ //scene.cubicvr.camera.position = [playerEntity.position[0], 14, 15];
+ var p = GameLogic.GetFamily("Player")[0];
+ scene.cubicvr.camera.target = [p.sceneObject.position[0]+cameraSpeedDistance*23, 7.5+cameraSpeedDistance*30, 0];
+ scene.cubicvr.camera.position = [p.sceneObject.position[0]+cameraSpeedDistance*10, 8.5+cameraSpeedDistance*40, 7 + cameraSpeedDistance*70];
+
//pointLight.position[0] += dx;
//playerEntity.move(dx);
if(!firstFrame){
Please sign in to comment.
Something went wrong with that request. Please try again.