Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'antiportalwall'

  • Loading branch information...
commit af7dd8744567206f099decd78084f7f2ba4a9547 2 parents b2bca79 + a14cd35
@onedayitwillmake authored
View
12 js/ChuClone/components/player/RemoteJoystickInputComponent.js
@@ -221,10 +221,20 @@
return;
}
}
+
var angle = +message.payload.analog
this._keyStates['left'] = angle != 0 && angle < 360 && angle > 180;
this._keyStates['right'] = angle > 0 && angle < 180;
- this._keyStates['up'] = message.payload.button;
+
+ if(message.payload.button != "null") {
+ this._keyStates['up'] = message.payload.button;
+ } else if( angle != 0 ) {
+ var range = 45;
+ // 45 degrees left of pure up, or right of pure up
+ this._keyStates['up'] = angle > (360-range) || angle < range;
+
+ console.log( angle > (360-range),angle < range )
+ }
this.resetIdleTimer();
View
6 js/ChuClone/components/portal/AntiPortalWallComponent.js
@@ -46,7 +46,7 @@ Abstract:
var dimensions = this.attachedEntity.getDimensions();
var geometry = new THREE.CubeGeometry( dimensions.width + 100, dimensions.height + 10, dimensions.depth + 10);
var mesh = new THREE.Mesh( geometry, [new THREE.MeshLambertMaterial( {
- color: 0xff2a00,
+ color: 0xdd00FF,
opacity: 0.25,
transparent: true,
shading: THREE.SmoothShading,
@@ -89,7 +89,7 @@ Abstract:
//this.depth = aDepth;
// THIS TRICK CURRENTLY ONLY WORKS FOR RECTANGULAR/CUBE ENTITIES
- var delta = 25;
+ var delta = 15;
aWidth += delta;
aHeight += delta;
aDepth += delta;
@@ -117,7 +117,7 @@ Abstract:
* Restore material and restitution
*/
detach: function() {
- this.attachedEntity.getView().parent.removeChild( this.clone );
+ this.clone.parent.removeChild( this.clone );
this.clone = null;
ChuClone.components.portal.AntiPortalWallComponent.superclass.detach.call(this);
}
View
5 js/ChuClone/components/portal/PortalGunComponent.js
@@ -213,9 +213,9 @@
* Creates two portals, orange & blue
*/
setupPortals: function( ) {
- var width = 2 * PTM_RATIO;
+ var width = 2.5 * PTM_RATIO;
var height = PTM_RATIO/2;
- var depth = 2 * PTM_RATIO;
+ var depth = 2.5 * PTM_RATIO;
var colors = [0xFF00FF, 0xff0054];
@@ -449,6 +449,7 @@
// Things that if we hit them - our tracer bullet is considered inactive
if (otherActor == that._nextPortal
+ || otherActor.getComponentWithName(ChuClone.components.portal.AntiPortalWallComponent.prototype.displayName)
|| otherActor.getComponentWithName(ChuClone.components.FrictionPadComponent.prototype.displayName)
|| otherActor.getComponentWithName(ChuClone.components.DeathPadComponent.prototype.displayName)
|| otherActor.getComponentWithName(ChuClone.components.JumpPadComponent.prototype.displayName)) {
View
30 js/ChuClone/editor/PlayerGUI.js
@@ -42,6 +42,11 @@
*/
_controls: [],
+ /**
+ * @type {Boolean}
+ */
+ _allowPortalGun: false,
+
setupGUI: function() {
var that = this;
this._gui = new DAT.GUI({width: ChuClone.model.Constants.EDITOR.PANEL_WIDTH});
@@ -51,6 +56,9 @@
this._controls['Create'] = this._gui.add(this, 'createPlayer').name("Create");
this._controls['Destroy'] = this._gui.add(this, 'destroyPlayer').name("Destroy");
this._controls['Reset'] = this._gui.add(this, 'resetPlayer').name("Reset");
+ this._controls['Portal'] = this._gui.add(this, '_allowPortalGun').name("Allow Portal Gun").onChange(function(){
+ that.togglePortalGun();
+ })
this._gui.close();
this._gui.open();
},
@@ -114,6 +122,7 @@
ChuClone.editor.WorldEditor.getInstance().getWorldController().getWorld().DestroyBody( playerbody );
this._player = null;
+
},
/**
@@ -153,6 +162,27 @@
this._player.getBody().SetPosition(new Box2D.Common.Math.b2Vec2( respawnPoint.attachedEntity.getBody().GetPosition().x, respawnPoint.attachedEntity.getBody().GetPosition().y - 1));
},
+ togglePortalGun: function( value ) {
+
+ if( !this._player ) {
+ ChuClone.utils.displayFlash("ChuClone.editor.PlayerGUI.resetPlayer<br>There is no player!!", 0);
+ return null;
+ }
+
+ var hasPortal = this._player.getComponentWithName(ChuClone.components.portal.PortalGunComponent.prototype.displayName);
+ if( this._allowPortalGun === hasPortal ) return;
+
+
+ if(this._allowPortalGun) {
+ var portalGunComponent = new ChuClone.components.portal.PortalGunComponent();
+ portalGunComponent.setGameView( ChuClone.GameViewController.INSTANCE );
+ portalGunComponent.setWorldController( ChuClone.model.Constants.PHYSICS.CONTROLLER );
+ this._player.addComponentAndExecute( portalGunComponent );
+ } else {
+ this._player.removeComponentWithName(ChuClone.components.portal.PortalGunComponent.prototype.displayName);
+ }
+ },
+
/**
* Deallocate resources
*/
Please sign in to comment.
Something went wrong with that request. Please try again.