30 paces left is hard to find when you don't know where to start..
smurfted
Member, PRO Posts: 586
Another nooby question..
the co-ordinates i get from screen touches are a screen co-ordinate or are they the global co-ords?
Comments
X and y are global. Is that what you mean for coordinates?
nice one thank you..
game.touches.touch 1.X i have just made a check and it's defiantly a local x (as in the screen co-ordinate, not global).
So how can i know the global co-ordinates of a screen touch?
game.touches.touch 1.X is definitely a "game attribute." (Which translates to "global variable.")
But it returns the position of the touch in screen coordinates -- which is between 0 and the screens maximum size.
Are you asking how to get the corresponding x,y coordinates in the scene? Just add the camera offset the touch location.
My actors co-ordinanates are global but the screen touch and mouse position seem to be screen co-ordinates?!
How can i find out the global co-ordinates of where your touching?
Epic, where can find the cameras offset?
Your use of 'global' is a little confusing to the question somewhat, to most people 'global' refers to a global (’Game') attribute, I'd alway recommend you stick with GameSalad terms. You might also want to give the question a little context, for example I suspect your scene is larger than the screen sIze and you are having an issue when the camera moves beyond the starting point (but this is just a guess of course) ?
When you touch the screen of - for example - an iPad it registers the position of your finger on the physical screen. So something like 'display mouse position X' will display the position of a touch on the physical screen.
So half way across an iPad screen will be x=512.
Now if you have a large scene, larger than your 1024 x 768 pixel iPad screen, and you move the camera right by - for example - 10,000 pixels then when you touch the middle of the screen it will still register as x=512 as you are still touching the middle of the physical screen.
But that touch point is x=10,512 pixels in your "scene" - which is, as RThurman said, your touch position + how much the camera has moved (so mouse/touch X + camera origin X).
Nice one, i will get the terminology eventually. Thank you for understanding my trouble.
It worked i had trouble finding the camera origin x. I had to select and unlock the individual actor in the scene to get access to that info.. Why is that?
Scene attributes can only be accessed after unlocking an actor in a scene. Why is that? I don't know but it's always been that way. It's a bit of a pain when needing to work with camera attributes. If you need to have other actors access the camera origin, you can create two game attributes, something like game.cameraX and game.cameraY (both real) and then unlock an actor in the scene and constrain those two attributes to the actual camera scene attributes. Then when another actor needs to access the camera origin, it no longer has to be unlocked... it can just access the value using the game attributes.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User