Ninjadoodle Posted October 24, 2014 Share Posted October 24, 2014 Hi @enpu I'm just wondering whether it would be possible to make Panda automatically adjust the co-ordinates of created sprites depending on game.scale, to correctly position sprites at every resulting mode @2x, @4x etc. Currently every time I create an sprite, I do (using the base resolution) ... rock.position.set(160*game.scale, 224*game.scale); ... when I create a new sprite. This is not really too much of a hassle until I forget to use it in a couple of places and then spent an hour figuring out why my sprite is showing in the wrong place. Just wondering whether this is possible? Thank you heaps in advance! Quote Link to comment Share on other sites More sharing options...
enpu Posted October 24, 2014 Share Posted October 24, 2014 Hmm, i can make it work with the Sprite constructor, but not with position.set(or then i have to create new method for Sprite, like setPosition, that will multiply values with game.scale) Would that be useful? Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 24, 2014 Author Share Posted October 24, 2014 That would be awesome! Please, only do this, if it's not too much of a bother, it was just a suggestion/question I really appreciate your work on Panda! Quote Link to comment Share on other sites More sharing options...
enpu Posted October 24, 2014 Share Posted October 24, 2014 Just updated develop branch,Sprite constructor should now multiply position with game.scale Quote Link to comment Share on other sites More sharing options...
Phempt Posted October 24, 2014 Share Posted October 24, 2014 is this feature included in panda 1.9, or in the new development branch? Quote Link to comment Share on other sites More sharing options...
enpu Posted October 24, 2014 Share Posted October 24, 2014 develop branch Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 24, 2014 Author Share Posted October 24, 2014 Hi @enpu You are awesome and I wish we could buy you a beer or 6 haha I tried the the latest develop but it doesn't seem to be updating form me ... I'm using ... rock.position.set(160, 224); (at a base resolution of 480x320) but at higher resolution it's not updating the positions. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 24, 2014 Share Posted October 24, 2014 Yeah it only works with constructor:var sprite = new game.Sprite('sprite.png', 160, 224); // This workssprite.position.set(160, 224); // This doesn't work Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 24, 2014 Author Share Posted October 24, 2014 Sorry, I misunderstood I take it with the tween engine + updating the sprite position on update etc. we still have to * by game.scale? Thanks you heaps!! Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 25, 2014 Author Share Posted October 25, 2014 Hi @enpu I've been thinking about this a little bit and wondering, whether it might be a good idea to separate the 'automatic multiplying by game.scale' away from the actual engine and into a 'helper function/method'. I'm worried that new people to Panda might get confused as why you sometimes have to multiply by game.scale and sometimes not (e.g. constructor vs. position.set). I think that something like you suggested before would work ... position.set - works manually (you have to multiply by game.scale)setPosition - could be a function then does the multiplication for you. Perhaps, eventually these 'helper functions' could work on Sprites, Containers and Tweens? If you have time, please let me know what you think and whether this is something that would work, or if it's plausible. I really appreciate the time you put into developing Panda and would be glad to support it commercially (or at least donate to it's development - even if the payment is coffee or beer ) Thank you again!! 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.