主:LUA尝试调用Box2D_Init为nil值,为什么?

发布于 2025-01-24 21:15:40 字数 914 浏览 4 评论 0原文

编辑:显然我没有正确安装库? (我的爱情版本是11.4)。也许我应该将问题重命名为如何正确安装此库。但是,也许还有更多关于导致此错误的真相(我一直陷入困境2天,我不知道为什么作者只会将这个错误排除在公开之外

https://github.com/karai17/simple-tiled-implementation/ Tree/Master/STI

我将其与我的Main.lua相同的目录,其文件结构与Git完全相同

local push = require "push"
local fsm = require 'statemachine'
local sti = require 'sti'
function love.load() 
push:setupScreen(common_res[3][1], common_res[3][2], my_w, my_h, {fullscreen = false})
map = sti("untitled.lua")
local layer = map:addCustomLayer("Sprites", 4);
local player 
for k, object in pairs(map.objects) do      
    if object.name == "player" then         
        player = object
        break
    end 
end
love.physics.setMeter(32);
world = love.physics.newWorld(0,0)
map:box2d_init(world);

EDIT: obviously I didnt install the library correctly? (my version of love is 11.4). perhaps i should rename the question to how do i properly install this library. but maybe there are more truths to be found as to what causes this error(i've been stuck at it for 2 days and i can't figure out why the author would just leave this bug out of the open)

the library in question
https://github.com/karai17/Simple-Tiled-Implementation/tree/master/sti

i have it on the same directory as my main.lua with the exact same file structure as in the git

local push = require "push"
local fsm = require 'statemachine'
local sti = require 'sti'
function love.load() 
push:setupScreen(common_res[3][1], common_res[3][2], my_w, my_h, {fullscreen = false})
map = sti("untitled.lua")
local layer = map:addCustomLayer("Sprites", 4);
local player 
for k, object in pairs(map.objects) do      
    if object.name == "player" then         
        player = object
        break
    end 
end
love.physics.setMeter(32);
world = love.physics.newWorld(0,0)
map:box2d_init(world);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时光的容颜 2025-01-31 21:15:40
map = sti("untitled.lua", {"box2d"})
map = sti("untitled.lua", {"box2d"})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文