LoginSignup
0
0

playdate by lua "CoreLibs/object.lua:65: field 'baseObject' is not callable (a nil value)"

Posted at

CoreLibs/object.lua:65: field 'baseObject' is not callable (a nil value)

躓いたので...
ゲームを作る上でまずはタイトル画面を作ろうと思いまして
Sceneを別クラスで実装した訳です。
しかし、以下のようなコードで仮作成してさて挙動を確認しようとしたら...

スクリーンショット 2023-10-26 20.03.02.png

local pd <const> = playdate
local gfx <const> = pd.graphics

class('TitleScene').extends(gfx.sprite)

function TitleScene:init()
    print("TitleScene:init")
end

function TitleScene:update()
    print("TitleScene:update")
end

解決策

import "CoreLibs/sprites"

はいw
classに関連してCoreLibs/spritesのimportが必要でした

明示的に記載あるわけではないけど、playdateでゲームを作る場合、main.luaなりなんなりに公式で記載のあるimportはしといた方がいいですね。

https://sdk.play.date/2.0.3/Inside%20Playdate.html#basic-playdate-game
スクリーンショット 2023-10-26 20.09.53.png

私の場合不要なimportはしないのがデフォルトなので、気づくのに時間かかりました。
「CoreLibs/object.lua:65」の中身見れたらもっといいんだけどな...

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0