___________ Posted August 12, 2016 Share Posted August 12, 2016 I'm having trouble making a constructor from my game. Whenever I try to use PIXI.Sprite.call and change any of the properties it errors saying whatever I tried to change isn't defined! Please help! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 12, 2016 Share Posted August 12, 2016 Duuuuudeeee! Please provide the code. At least a snippet. Don't worry, we'll help you Quote Link to comment Share on other sites More sharing options...
___________ Posted August 12, 2016 Author Share Posted August 12, 2016 Oh, sorry! Here it is: cargle.Card = function() { PIXI.Sprite.call(this, new PIXI.Texture(new PIXI.BaseTexture("assets/sprites/card/card_back.png", PIXI.SCALE_MODES.NEAREST))); this.scale.x = 3; this.scale.y = 3; this.position.x = 50; cargle.stage.addChild(this); }; Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 12, 2016 Share Posted August 12, 2016 PIXI.BaseTexture does not accept String as first param. It accepts Image or Canvas. Please look at how PIXI.loader or fromImage works: https://github.com/kittykatattack/learningPixi Quote Link to comment Share on other sites More sharing options...
___________ Posted August 12, 2016 Author Share Posted August 12, 2016 Could I do something along the lines of PIXI.Sprite.fromImage.call(this, ...) ? 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.