Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

absolute position of displayObjects/sprites/primitives


InsOp
 Share

Recommended Posts

Hello,

ive been struggling with the positions of sprites within displayobjectcontainers. Its hard to calculate the absolute position on the screen.

Ive been calculating it like this:

 var sx = attacker.sprite.position.x + attacker.sprite.parent.position.x; var sy = attacker.sprite.position.y + attacker.sprite.parent.position.y; var tx = target.sprite.position.x + target.sprite.parent.position.x; var ty = target.sprite.position.y + target.sprite.parent.position.y;

now im shooting lasers (another DOC) from sx|sy to tx|ty and im having a hard time to calculate whether the laser intersects with the target sprite since the positions 

of everything is pretty much fucked up. Is there a good way to get the "world"-position or "absolute"-position?

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