10 years ago by BlairH
I have a every simple game that I am currently developing. It is just a basic spaceship shooter.
I have four screens:
Title/Opening
Game
Winner
Lose
I am using the touch button add-in to place buttons on the screen for up,down and shoot.
On the desktop I am using spacebar, up arrow and down arrow.
This problem that I am having is with the mobile version. When I run it in the simulator I get the buttons, but they will not bind with the up,down and shoot functions.
Main.js
It binds fine with the desktop functions.
It also works fine if I go directly into MyGame - rather than the Opening title screen.
I have put a few console.log checks in and they all are working as expected.
Any help would be appreciated.
Thanks,
I have four screens:
Title/Opening
Game
Winner
Lose
I am using the touch button add-in to place buttons on the screen for up,down and shoot.
On the desktop I am using spacebar, up arrow and down arrow.
This problem that I am having is with the mobile version. When I run it in the simulator I get the buttons, but they will not bind with the up,down and shoot functions.
Main.js
init: function() {
console.log('Step 2');
if(ig.ua.mobile){
this.buttons = new ig.TouchButtonCollection([
new ig.TouchButton('up', {left:0, bottom:0}, 70,75,this.buttonImage, 0),
new ig.TouchButton('down', {left:128, bottom:0}, 70,75,this.buttonImage, 1),
new ig.TouchButton('fire', {right:128, bottom:0}, 70,75,this.buttonImage, 2)
]);
this.buttons.align();
console.log('Step 3');
}
else
{
ig.input.bind( ig.KEY.UP_ARROW, 'up' );
ig.input.bind( ig.KEY.DOWN_ARROW, 'down' );
ig.input.bind(ig.KEY.SPACE, 'fire');
}
this.loadLevel( LevelMain );
It binds fine with the desktop functions.
It also works fine if I go directly into MyGame - rather than the Opening title screen.
I have put a few console.log checks in and they all are working as expected.
Any help would be appreciated.
Thanks,
