queequeg Posted March 18, 2017 Report Share Posted March 18, 2017 I've been having difficulty figuring out how to interact with my sprites from the chrome dev console. Is there a standard way to do that? Lets say that you add a sprite initGraphics: function () { this.shipSprite = game.add.sprite(shipProperties.startX, shipProperties.startY, graphicAssets.ship.name); this.shipSprite.angle = -90; this.shipSprite.anchor.set(0.5, 0.5); }, I can see my sprite and make it move around but when I bring up chrome console I can't seem to figure out how to directly access it's x and y properties. Quote Link to comment Share on other sites More sharing options...
queequeg Posted March 18, 2017 Author Report Share Posted March 18, 2017 I'm working through this tutorial: http://www.zekechan.net/asteroids-html5-game-tutorial-1/ Quote Link to comment Share on other sites More sharing options...
squilibob Posted March 19, 2017 Report Share Posted March 19, 2017 window.game.world.children[x] where x is the sprite number. since it is the only sprite this would be window.game.world.children[0] Quote Link to comment Share on other sites More sharing options...
queequeg Posted March 19, 2017 Author Report Share Posted March 19, 2017 Thanks squilibob 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.