Jump to content

What is the difference between directly setting `spriteObj.x = 3` and using setter `spriteObj.position.set(3, spriteObj.y)`?


nautics889
 Share

Recommended Posts

Obviously i didn't read docs attentively, but what is the practice difference between setting x/y directly 

spriteObj.x = 3;

and using setter 

spriteObj.position.set(3,  spriteObj.y);

I looked to me like nothing was affected, but i'm afraid that further there appears smthn suddenly. Also in case if the second one is really more correct way, how can i set only x coord in beautiful way? For instance, moving obj:

spriteObj.x += 10;  // looking nice but omits setter

spriteObj.position.set(spriteObj.x + 10, spriteObj.y);  // too long as for me and requires both coords, here are 3 calls of `spriteObj`

 

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