Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

7 years ago by coreysnyder

I use the the binding of ig.KEY.MOUSE1 for touch events on iOS for all of my games. I just upgraded one of my games to ImpactJS 1.22 and now those same touch events no longer fire. Anyone else have similar issues and find the solution? I added the code below to my game to see what the issue was and '_clicked' never gets set to true.

// This is in my game init
ig.input.bind( ig.KEY.MOUSE1, 'click' ); 

//This is in the update loop
var _clicked = ig.input.state( 'click' );

if(_clicked){
        console.log(ig.input.mouse.x + "^" +ig.game.screen.x + "^" + this.pos.x);
}

7 years ago by dominic

Works for me™. I just tried it in mobile Safari and Chrome for iOS.

7 years ago by noGrip

CoreySnyder, it's also happening to me. The mouse click fires my bullets in the ios simulator, but the touch in the ipad isn't working (im also under impact 1.22), but this was my first deploy in the ipad, I was actually searching the forum for similar situations.

my code for clicking:

init: function() {
		// init level
		this.loadLevel(LevelLevel1);
		//key binding
		ig.input.bind( ig.KEY.MOUSE1, 'click' );
	},
	
	update: function() {
		// Update all entities and backgroundMaps
		this.parent();
		
		//click
		if (ig.input.pressed('click')){
			var tower = ig.game.getEntitiesByType(EntityTower)[0];
			var x0 = tower.pos.x;
			var y0 = tower.pos.y;

                       .......................
               }
       }
.......


Tips?

7 years ago by coreysnyder

@Dominic sorry I should have specified that I'm using Ejecta as well. I actually had to roll back to an older version of ImpactJS to get my latest game out on iOS because the touch's wouldn't register. Does it need to be used with a particular version of ejecta? I tried using my same copy of ejecta and it didn't work. So I rolled forward to a later version off the github page and I ran into a multitude of other problems. Though most were related to my dev environment I later discovered. I'm going to give it a try on my next game which I started today. I am starting from the latest version of ImpactJS. I will let you know if I see any issues. This will also be released on browser/iOS.

Here's my released game btw: https://itunes.apple.com/us/app/zombie-ops/id636526645?ls=1&mt=8

7 years ago by coreysnyder

@NoGrip which version of Ejecta were you using? I speculate that this probably has something to do with it.

7 years ago by noGrip

I think it was the latest release. I will check later and report back here

thanks!

7 years ago by noGrip

Ok, I was using Ejecta 1.2 and Impact 1.22. In the xcode simulator (for ios5.1) everything was fine, but not on the ipad.

So I tried the development version of Ejecta, and now the xcode simulator also isn't responding to mouse clicks. At least it's a consistent behaviour.

I will try with Impact 1.21 now.

7 years ago by noGrip

Ok, don't have the 1.21 version. Had to try it with 1.20, and it worked! The touches fired.

There is definitely something to fix in version 1.22 of Impact Dominic!

Cheers!

6 years ago by bigJim

I think I am experiencing the same issue and have found a 'solution'. It's simple (just a couple lines) but potentially adds a little complexity that could be reduced with the finesse of someone more familiar with the code. Here's a simple explanation (below is the diff for input.js):

checkForPress() is getting called before pressed() gets called and resets this.lock[action] = false. Perhaps due to the asynchronous nature of the keypress event. (right?) So you just have to make sure pressed() gets an opportunity to check for the keypress before clearing.

Here's the diff:

index 4025313..31ebed1 100755
--- a/games/lib/impact/input.js
+++ b/games/lib/impact/input.js
@@ -278,7 +278,9 @@ ig.Input = ig.Class.extend({
},


+ checkedForPress: false,
pressed: function( action ) {
+ this.checkedForPress = true;
return this.presses[action];
},

@@ -291,8 +293,11 @@ ig.Input = ig.Class.extend({
this.actions[action] = false;
this.locks[action] = false;
}
- this.delayedKeyup = {};
- this.presses = {};
+ if (this.checkedForPress) {
+ this.checkedForPress = false;
+ this.delayedKeyup = {};
+ this.presses = {};
+ }
},

touchStart: function( event, action ) {

6 years ago by jessefreeman

I was just trying out Ejecta too on the latest build of Impact and noticed the same issue. I had to revert back to Impact 1.20 for mouse events to work.

@bigJim I tried your diff but it didn't fix the problem for me.

6 years ago by Berg

I'm experiencing this same issue as well. Using Impact 1.22 and Ejecta 1.3, ig.input.state/pressed/release events set to ig.KEY.MOUSE1 are not firing.

@bigJim, I tried your diff as well, with no success.

6 years ago by Berg

Upgrading to the latest master of the Ejecta github fixed the issue for me!
Page 1 of 1
« first « previous next › last »