如何在 corona sdk 的容器中放置一些东西?

How do I place something inside of a container in corona sdk?

我想将各种对象放置在容器的一侧(在我的例子中是一个矩形)。大多数对象将位于矩形的角中。这可能吗?

local rectangle = display.newRect(100,100,100,100)

首先,您可能需要按照场景教程进行操作 here

要回答您的具体问题,您可以创建 "display groups" 并向其中添加项目。这些用作容器。你甚至可以嵌套它们!从技术上讲,这些只是 lua 个表格,但 Corona 将它们用作展示容器。

举个例子:

local container = display.newGroup()
local rectangle1 = display.newRect(100,100,100,100)
rectangle1:setFillColor(0) --black

local rectangle2 = display.newRect(102,102,96,96)
rectangle2:setFillColor(0.5) --grey

--The order of inserting determines which item will be displayed on top
--Here the black rectangle is on the bottom and the grey one on top of it
container:insert(rectangle1)
container:insert(rectangle2)

我仍然强烈建议您遵循完整的教程,因为它会教您使用 CoronaSDK 进行编程的所有基础知识。然后可以使用您的朋友 Google 找到所有高级内容(这将 link 在这里或到 Corona Docs)。