lars Posted October 23, 2015 Share Posted October 23, 2015 I have the following: game.createScene('Main', { backgroundColor: 0x630909,init: function(message) {var player = new game.Alien(100,100);}, keyup: function(key) { if (key === 'SPACE') { var tween = new game.Tween("call my player object here"); tween.to({x:800}, 1000); tween.start(); } }});How can i call the "player" object in my tween Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 24, 2015 Share Posted October 24, 2015 Hi @lars You need to make player -> this.player in order to access it from other functions. the other way to do it is by keeping -> var player ... and attaching a function to it. var onKeyUp = function() {... player.keyUp = onKeyup; Hope this helps Quote Link to comment Share on other sites More sharing options...
lars Posted October 26, 2015 Author Share Posted October 26, 2015 Thank´s a lot for the answer. I´ll try that .... 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.