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 parse JSON Data in Corona SDK [duplicate]
How to make an object change its look on collision with another object in corona sdk
Drop Down animation for Image on Tap
Sound is not working properly in Corona SDK
How can i properly align Arabic text using the Corona SDK?
Can we change physics body properties in runtime - corona sdk
How to slide pages in Corona SDK
Return Data on showwebpopup
How to pause game and display new layer in corona
Corona SDK pathToFile issue
How to integrate fortumo In-App purchase plugin to Corona Sdk game?
How to make the PNG's transparent region not be listened by the EventListener when a touch event happened?
Corona SDK - group with image rect, wrong reference point
CORONA SDK Physics that dont affect every sprite
corona storyboard dispatch event error
Web view Background trasparency