当触发时,圆形不会消失。

我正在学习Lua,并使用Corona(http://www.anscamobile.com/corona/)制作我的第一个"Game"。 进展还可以,但我的代码没有按照预期工作。

问题是圆圈没有像他们应该的一样闪烁。 我知道如果我在重置函数中放置一个渲染(例如display.newText(“test”,50,50,nil,53),它会呈现,但它不会闪烁。

它给我这个错误:

?:iRuntime错误…\用户\david\document\corona projects\test\main.lua:19:试图索引字段“?”(空值)栈回溯:[C]:?…\用户\david\document\corona projects\test\main.lua:19:在函数'_listener'中尝试索引字段“?”(空值)?:在函数<?:514>中?:iRuntime错误…\用户\david\document\corona projects\test\main.lua:19:尝试索引字段“?”(空值)栈回溯:[C]:?…\用户\david\document\corona projects\test\main.lua:19:在函数'_listener'中尝试索引字段“?”(空值)?:在函数<?:514>中?:i

编辑:已修复

修好了 - 我忘记给它分配位置。

table.insert(starTable,display.newCircle(random0,cwidth),random0,cheight),random0.82.3)))

改为

table.insert(starTable,i,display.newCircle(random0,cwidth),random0,cheight),random0.82.3)))

原文链接 https://stackoverflow.com/questions/8628910

点赞
stackoverflow用户1502079
stackoverflow用户1502079

你应该在 starTable 中指定一个位置来放置你的圆,否则它将会被插入到表的末尾:

table.insert(starTable, position, display.newCircle(random(0, cwidth), random(0, cheight), random(0.8, 2.3)))

更多关于 Lua 表的信息:

http://lua-users.org/wiki/TablesTutorial

http://www.lua.org/pil/19.2.html

2013-05-31 17:11:16