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

1 decade ago by Jon123

I've been trying to convert the physics demo into an apk using cocoonjs, which involved coding the canvas using js instead of putting it in the index.html file:

var obj = document.getElementById('game')
var c = document.createElement('canvas'); = 'canvas';

var b1 = document.createElement('div'); = 'buttonLeft';
b1.className  = 'button';

var b2 = document.createElement('div'); = 'buttonRight';
b2.className  = 'button';

var b3 = document.createElement('div'); = 'buttonShoot';
b3.className  = 'button';

var b4 = document.createElement('div'); = 'buttonJump';
b4.className  = 'button';

The problem is that the touch buttons don't appear on the phone, you can touch anywhere on the screen though and the jetpack guy boosts...

Anyone know where I am going wrong?

1 decade ago by dominic

I'm not sure how CocoonJS handles those additional HTML elements, but I think you still have to position those buttons somehow and also set their appearance.

However, I would advise you to ditch those additional HTML elements completely and go with the Touch Button plugin:

1 decade ago by Jon123

Thanks Dominic,

I didn't realise the jumpnrun example catered for this. I've got it to work with that so will have a go re-factoring my game a bit.

1 decade ago by y0ungb0b

I think Cocoon will throw errors/warnings in its console if it comes across things it doesn't support.
Page 1 of 1
« first « previous next › last »