ansien123 Posted January 3, 2016 Share Posted January 3, 2016 game.module( 'game.main').body(function() { game.createClass('Platform', 'Graphics', { init: function() { this.beginFill(0x00cc00, 1); this.drawRect(0, 0, 100, 100); game.scene.stage.addChild(this); }); game.createScene('Main', { backgroundColor: '#666', init: function() { var platform = new game.Platform(); } });});I followed this example: http://vermeire.home.xs4all.nl/panda/fiddler.html , which uses "this._super();", and that also doesn't seem to work anymore? It's just showing a gray screen. Where do i find good documentation/tutorials/examples? Quote Link to comment Share on other sites More sharing options...
Stephan Posted January 3, 2016 Share Posted January 3, 2016 Hi Ansien, try this:game.module( 'game.main').body(function() { game.createClass('Platform', 'Graphics', { init: function() { this._super(); this.beginFill(0x00cc00, 1); this.drawRect(0, 0, 400, 100); this.endFill(); //set fill and draw another rectagle that is filled in addition to the line game.scene.stage.addChild(this); } }); game.createScene('Main', { backgroundColor: 0xeeeeee, init: function() { var platform = new game.Platform(); } });});You where almost there, you just forgot a curling bracket and you DO need this_super() to call the parent constructor function befaore you can use graphics functions. Stephan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.