how can I know what's the coordinate of screen center ?
jasonshow
Member Posts: 71
my player is running,and screen always go right,
how can I know what's the coordinate of screen center ?
thanks.
how can I know what's the coordinate of screen center ?
thanks.
Comments
So if your scene is 480x320 center would be (240,160)
That what your wanting to know?
but my screen is bigger than 480x320,(maybe 100000x320)
and I make it auto scroll to right.
so, how can I know what's the coordinate of screen center?
thanks.
Display Text:
Self.X
Self.Y
And make sure to make the "camera area" as tiny as possible on the editor.
So it may be like this:
1. Make a new actor, let's say centerSearcher
2. Put it on your Scene
3. Double-Click the Scene actor NOT THE PROTOTYPE and click the locker to acces its behaviors.
4. Now you can access Scene attributes from there and pass them to Game attributes if needed.
dunkelgeist,seems good, but what's attribute of scene that I realy need ?
thanks.
CurrentScene.Size.Height / 2
Will give you the coordinates you need for X and Y ;-)
That is if you need the permanent true center of your Scene, otherwise, if you want to have the center of the visible area I'll probably stick with cbt method but adding an additional actor constrained in position to the camera, so you can set any size you want.
it will get the whole scene's center,
but I need is this screen's center.
(the screen is scrolling to right)
If Camera.Origin.X and Y mark the camera center you're good to go.
If they mark the bottom-left corner then you could do something like:
Camera.Origin.X + Camera.Size.Width/2
Camera.Origin.Y + Camera.Size.Height/2
Again, just guessing, but hope it helps.
it works!