Jump to content

X, Y and game.scale question


Ninjadoodle
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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!!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...