Hey everyone. I started messing around with Corona yesterday (fresh off the boat!) but I’ve already knocked out a test game based on a tutorial, and figured things out pretty easy. I took the “Attack of the Cuteness” tutorial game, finished it, and ended up adding some extra stuff to it when all in said and done. Got it loaded on my Galaxy S5 and it’s playable.
Anyway, I’ve started on a “from-scratch” game just to screw around but I’m having a lot of trouble with finding a good resources on understanding coordinates and what to use in my functions.
I know 0,0 is top-left, the X-axis is left to right and Y-axis is top to bottom. I’m familiar with centering objects (display.contentCenter) but in the game I’m attempting now, I’ve managed to set up an image sheet with frames, and I’m using an individual frame for my “hero.” I want to bring him from off-screen at a specific part of the background image.
I can just sit there and keep putting values in until it looks right, but I’m trying to figure out an easy way to determine what coordinates are where. Through trial-and-error I sort of figured out the X-axis total is around 500, and the Y-axis is around 300. But is there any way in Corona Simulator to show coordinates where the mouse is located? Or something similar?
For reference here’s the code I’m using:
function spawnHero() local hero = display.newImage( sheet, 1 ) hero.xScale = .75 hero.yScale = .75 hero.x = centerX + 50 hero.y = centerY + 50 transition.to (hero, {time=1000, x=centerX , y=centerY}) end
The hero.x and hero.y I’m going to end up placing outside the screen boundaries, and the x= and y= in the transition.to will be a bit off center.