2
화면에 새 개체를 생성하는 클래스를 만들려고합니다. 이건 내 클래스입니다코로나 SDK가있는 모듈 식 클래스
local box = box.new("First", 0, 62) -- Spawn a Box on the Screen on X = 0, Y = 62
: 나는
내 목표 this tutorial을 다음 있어요 뭔가 연결이 수행했다 단지 level1.lua에 require ("box")
을 수행하여 지금까지
box.lua
local box = {}
local box_mt = {__index = box } -- metatable
function box.new (nome, x, y)
local newbox = {
local nome = display.newImageRect("images/box.png", 210, 70)
newbox.x = x
newbox.y = y
}
return setmetatable(newbox, box_mt)
}
end
을 내 게임이 충돌합니다
This is the error
Failed to parse error message: error loading module 'level1' from file '/Users/mc309bza/Desktop/Corona/Platform/level1.lua':
/Users/mc309bza/Desktop/Corona/Platform/level1.lua:28: syntax error near 'function'
아이디어가 있습니까? 감사!
28 행은 무엇입니까? – lhf
또한'local nome ='은 구문 오류입니다. 로컬 테이블 필드가 없습니다. – lhf