adding objects to screen in corona sdk without defining x y coordinates? corona sdk
A very simple beginners question... I assume this must be possible.... How do you add objects to a screen in Corona (take simple standard widget items like buttons) in a way that they just appear below each other and so avoid having to give each item a "top" value that is relative to the top of the screen? Surely there is a way of doing this either automatically or referencing the previous object to place the next objects position? I thought grouping items may assist with this but hasn't with my experiments so far.
You can use variables and information about other objects to define positions of buttons. Let's say you have an object, button1. You want another object, button2, to be 20 pixels above it. button1.y = 45 print(button1.y)--You'll get 45. button2.y = button1.y - 20--Remember that the origin (0,0) is at the top left. Subtracting 20 makes the object closer to the top. print(button2.y)--You'll get 25. X, Y coordinates can be defined by a combination of variables with mathematical operations. You can greatly speed up your code by defining many objects relative to one central object.
button2.x=button1.x button2.y=button1.y+20 .... button3.x=button2.x+20 button3.y=button2.y+20 You can design this way, in this way you can set the relative position of the buttons. I hope it will help you.
How to set Corona notification big view
Set object or button above the video in corona sdk
selectively upgrade existing sqlite database in corona by comparing database versions
Corona Near Field Comunication (NFR)
How can i make random generated quotes
Using perspective library with Corona SDK
What is the right way to zoom the camera out from a scene view?
Corona SDK Runtime Error on version 3.0.0
corona loadRemoteImage loading in another scene
What is a simple splash screen code for corona?
How to resize pickerwheel on corona sdk
How to allow external music/audio to continue in Corona SDK apps when they launch?
Can I put apps made on Corona SDK for windows on IOS?
Define coordinates with rotation (corona sdk)
Open 3rd party application in corona sdk
Corona SDK variable throughout different scenes