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

1 decade ago by Jerczu

Has anyone have any experience in creating the touch controls for the cocoon?? When I add my buttons programatically the game crashes on me every single time... What's the issue? I dont know.

 var f = document.createElement('img');
        f.id= 'fire';
        f.src='gun.png';
        f.style.position='absolute';
        f.style.bottom="0"
        f.style.right="0";
        f.style.width=100;
        f.style.height=100;
        document.body.appendChild(f);

and I use
ig.input.bindTouch('#fire','fire');

Crashes every single time... If I bind it to canvas though it doesnt crash...

1 decade ago by alexandre

Not sure it'll help but have you checked this thread?

1 decade ago by Jerczu

Yeah I did the controls crash the testing software if added this way. But I found a solution I'll pop it here once I test it properly.

1 decade ago by Jerczu

The solution is to create additional canvas and draw image object onto the canvas

1 decade ago by TigerJ

http://jimmybriggs.blogspot.com/

I have a big write up there with more coming.

My touch controls look like this:
var btn_dwn = document.createElement('img');
		btn_dwn.src="touch_down2.png";
		btn_dwn.id="btn_dwn";
		btn_dwn.style.position='absolute';
		btn_dwn.style.bottom=(window.innerHeight/2)-246;
		btn_dwn.style.left=(window.innerWidth/2)-80;//(window.innerHeight/4)-(btn_lft.height/2);
		btn_dwn.addEventListener("touchstart", function(){
			ig.game.spawnEntity(EntityBullet,-16,-16,{slocation:0});
		});
document.body.appendChild(btn_up);

1 decade ago by Jerczu

Nope - it crashes the launcher for me if done this way. (iOS6)
Page 1 of 1
« first « previous next › last »