首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我在第13行得到一个语法错误?(pico-8)

为什么我在第13行得到一个语法错误?(pico-8)
EN

Stack Overflow用户
提问于 2021-11-11 00:33:32
回答 1查看 47关注 0票数 0

我想自学编程,我认为pico-8非常适合我,但我真的很困惑,因为在第13行只有_update函数……我怎么搞砸了?

语法错误是,第13行(制表符0)处的未关闭函数

代码语言:javascript
复制
local guy_x
local guy_y

    -- lua scripting language

function _init()
    -- all the code that happens
    -- when the cart is firt run
    guy_x=64
    guy_y=64
end

function _update()
    --  all the code that
    -- updates the game state
    if btn(1) then
  guy_x+=1
  
end

function _draw()
    -- all the code that
    -- drwas thing to the screen
    cls() -- clears screen!
    rect(10,20,100,60,12) -- draws a blue rectangle
    -- rect(x1,y1,x2,y2,color)
    circ(20,20,20,14) -- draws a pink circle
    pset(90,50,9) -- draws one pixel
    rectfill(85,50,90,40,9)
    circfill(guy_x,guy_y,5,9)
    --  circfill(x,y,radius,color
end
EN

回答 1

Stack Overflow用户

发布于 2021-11-11 00:43:41

好吧,nvm我真的很愚蠢我只是忘了在if btn(1)then guy_x+=1之后写end

已修复:

代码语言:javascript
复制
function _update()
    --  all the code that
    -- updates the game state
    if btn(1) then
  guy_x+=1
  end
end
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69921858

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档