Corona SDK 中的透明墙?

所以我一直在使用 Corona 制作一个国际跳棋游戏,并一直在使用 Lua,只是为了更好地掌握它,当我制作我的棋盘时,我有一个透明墙,我无法在上面绘制。就像我使用一个函数来绘制圆形,它在任何其他地方都有效,但在我的屏幕右侧不起作用。我没有头绪,不知道错误来自哪里,只是想知道你们能帮我吗?另外,如果我的代码混乱,请原谅,我还在学习如何制作完整的程序。提前感谢。:)

以下是代码-

--所有必要值
local widget = require ("widget")
local redCount = 12
local blackCount = 12
local length = 40.05
local x = length / 2
local y = 80
local startX = x
local startY = y
local allowMoves = true
local black = {0, 0, 0}
local red = {1, 0, 0}

--标题显示
local title = display.newText("国际跳棋", display.contentCenterX, 10, native.systemFontBold, 40)

--函数
local function checkWinner()
    if (redCount == 0) then
        display.newText("黑队赢了!!!", display.contentCenterX, display.contentHeight - 60, nativeSystemFontBold, 37)
    elseif (blackCount == 0) then
        display.newText("红队赢了!!!", display.contentCenterX, display.contentHeight - 60, nativeSystemFontBold, 40)
    end
end

local function drawPoint(x, y, color)
    local pixel = display.newRect(x, y, 2.5, 2.5)
    pixel.fill = color
end

local function makeCircle(h, k, radius, color)
    for i = 1, 180, 1 do
        local b = math.sqrt((radius * radius) - ((i - h) * (i - h))) + k
        drawPoint(i, b, color)
        drawPoint(i, (b * -1) + k * 2, color)
    end
end

--制作棋盘
for i = 1, 8, 1
    do
        for k = 1, 4, 1
        do
            if i % 2 == 1 then
                display.newRect( x, y, length, length, 30)

            else
                display.newRect( x + length, y, length, length, 30)
            end
            x = x + (startX * 4)
        end
        y = y + length
        x = startX
    end

--制作轮廓
display.newRect(startX, startY - (length / 2), length * 15, 3, 30)
display.newRect(startX, y - (length / 2), length * 15, 3, 30)
display.newRect(startX - (length / 2), startY, 3, length * 15, 30)
display.newRect(320.4, startY, 3, length * 15, 30)

--制作红色棋子
x = length / 2
y = 80
for i = 1, 3, 1
    do
        for k = 1, 4, 1
        do
            if i % 2 == 1 then
                makeCircle( x, y, 17, red)

            else
                makeCircle( x + length, y, 17, red)
            end
            x = x + (startX * 4)
        end
        y = y + length
        x = startX
    end

在手机上显示的内容

点赞
用户14329040
用户14329040

你应该使用 physics.newBody 将线条变成"刚体"。然后使用颜色的 alpha 特性使其透明。

为了更详细的参考建议你查看文档

2020-12-13 16:26:17