Sunday, 15 June 2014

backbone.js - I am using crafty boiler plate for my html5 game, but backbone or jquery is conflicting? -



backbone.js - I am using crafty boiler plate for my html5 game, but backbone or jquery is conflicting? -

i have html5 game working on. uses crafty game engine , using boiler plate game engine uses backbone, jquery, , require js. have coded new backbone interface coded game not respond event handlers. there doing wrong. here code:

info = baseentity.extend({ defaults: { 'text_begin' : "<span id='info_begin' style='text-shadow:2px 2px #000;cursor:pointer; '>begin game</span>", }, initialize: function(){ var model = this; var entity = crafty.e("2d, html, dom, text, mouse") entity .attr({x: 20, y: 50, z: 1, w: 200}) .text(model.get('text_begin')) .textcolor('#ff0000') .textfont({'size' : '30px', 'family': 'arial', 'weight': 'bold'}) .setname('begin info') .bind("click", function(){console.log('hi tere')}) model.set({'entity' : entity }); } });

yes, misunderstanding how backbone set boiler plate game engine. interfaces 'read-only'. read wiki on craft boiler plate. if want create new interactive crafty entities need create new entities , not interfaces.

so, example, go scene file , declare new entity:

sc['info'] = new info();

you want create sure amd calling new entity file. file have ther moved entity folder , should interactivity.

html5 backbone.js craftyjs

No comments:

Post a Comment