【发布时间】:2022-12-18 21:38:03
【问题描述】:
我正在尝试制作 PacMan 的怪异版本,我需要一种快速的方法来绘制整个地图上的所有点(菱形)。 我的想法是用一个循环在每个 x,y 上绘制一个点,然后检查哪些点与墙碰撞并删除它们。 唯一的问题是我不知道如何获得墙壁的固定装置。 我将 Tiled 与 STI 库一起使用,并制作了一个可碰撞的对象层。 我是菜鸟,我不知道您需要哪些信息来帮助我,请告诉我您需要知道的信息。 太感谢了
function Coin.beginContact(a, b, collision)
for i,instance in ipairs(ActiveCoins) do
if a == instance.physics.fixture or b == instance.physics.fixture then
if a == Player.physics.fixture or b == Player.physics.fixture then
instance.toBeRemoved = true
return true
elseif a == map.layers.Solid or b == map.layers.Solid then
instance.toBeRemoved = true
return true
end
end
end
end
这就是我检查 Player 和 Coins 之间碰撞的方式,在 elseif 中我试图进行实验以获得墙壁的固定装置,但是 nada。
【问题讨论】: