The Daily Click ::. Forums ::. Klik Coding Help ::. Retreiving an Object's Actual Coordinates (not relative to the local view)
 

Post Reply  Post Oekaki 
 

Posted By Message

noahsummers



Registered
  17/01/2010
Points
  64
26th January, 2010 at 03:03:12 -

I'm trying to create a vertical parallax effect with a background element. The expression I want to use is fairly simple, and should work, I think, but I need to know what variable to use to get an object's coordinates relative to the whole frame (level), rather than just the visible portion.

Here's what I have at the moment (bonmobound being the bounding box object for the player character):

Always>> Set Y position to VirtualHeight-((VirtualHeight-Y( "bonmobound" ))/2)+60


Edit: Made a small amendment to the code.

The only problem, as far as I can tell, is that Y(" etc. ") only retreives the object's coordinates local to the view frame.

Edited by noahsummers

 
eight bit believer

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
26th January, 2010 at 03:07:35 -

Just use Y( "bonmobound" )

 
n/a

nim



Registered
  17/05/2002
Points
  7234
26th January, 2010 at 03:26:00 -

lol

 
//

noahsummers



Registered
  17/01/2010
Points
  64
26th January, 2010 at 03:37:00 -

Crap, you're right. Wasn't thinking straight.... Now I got to find out what's really wrong with this.

 
eight bit believer

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
26th January, 2010 at 04:01:12 -

Well now that you have the complex things down all you have left to learn is the easy stuff!

 
n/a

noahsummers



Registered
  17/01/2010
Points
  64
26th January, 2010 at 04:38:17 -

Haha, yeah, whenever I'm stumped with something programming-related, the solution always turns out to be embarrassingly simple... like so:

Always>> Set Y position to Frame Height-(Frame Height-Y( "bonmobound" ))/2-120


All I had to do was switch around the sign at the end of the expression. The + 60 bit was meant to bump the object upward slightly, but + is not equal to up on the MMF Y axis (the worst part of this mistake is that I didn't make it in the rest of the expression).

Does anyone happen to know why the Y axis is flipped in WYSIWYG editors?

 
eight bit believer

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
26th January, 2010 at 10:43:18 -

its not. in computer graphics the y axis is inverted. doesnt matter if you use an editor or program it in a computer language. unless the abstraction layer you are using makes the distinction for you, its always inverted. x increases to the right, y increases down. the easiest way to think about the reasoning is to think about a book. you read from left to right, top to bottom. its more natural.

 
n/a

noahsummers



Registered
  17/01/2010
Points
  64
26th January, 2010 at 15:47:24 -

Ah, I see. Thanks for the info.

 
eight bit believer
   

Post Reply



 



Advertisement

Worth A Click