Text love2d-更新打印文本的文本
我打印的文本上写着“是”。我还得穿上箭头形状的纽扣。我试图得到它,因此,如果我点击左箭头,它会说“不”,如果我点击右箭头,它会说“是”Text love2d-更新打印文本的文本,text,lua,updates,love2d,Text,Lua,Updates,Love2d,我打印的文本上写着“是”。我还得穿上箭头形状的纽扣。我试图得到它,因此,如果我点击左箭头,它会说“不”,如果我点击右箭头,它会说“是” fsdefault=“是” fs=love.graphics.print(fsdefault,440160) 爱。图形。绘画(拉罗,425163) 爱。图形。绘画(拉罗,470163) 函数love.update(dt) 功能爱。鼠标按下(x,y) 如果x>424,x161,y275,x305,y424,x161,y275,x305,y424和x
fsdefault=“是”
fs=love.graphics.print(fsdefault,440160)
爱。图形。绘画(拉罗,425163)
爱。图形。绘画(拉罗,470163)
函数love.update(dt)
功能爱。鼠标按下(x,y)
如果x>424,x<435,y>161,y<172,则
fsdefault=“否”
结束
如果x>275,x<320,y>305,y<325,则
fsdefault=“是”
结束
结束
结束
像这样的东西怎么样:
local fsdefault = ""
function love.mousepressed( x, y)
if x > 424 and x < 435 and y > 161 and y < 172 then
fsdefault = "No"
end
if x > 275 and x < 320 and y > 305 and y < 325 then
fsdefault = "Yes"
end
end
function love.draw()
love.graphics.print(fsdefault, 440, 160)
love.graphics.draw(larrow, 425, 163)
love.graphics.draw(rarrow, 470, 163)
end
local fsdefault=“”
功能爱。鼠标按下(x,y)
如果x>424,x<435,y>161,y<172,则
fsdefault=“否”
结束
如果x>275,x<320,y>305,y<325,则
fsdefault=“是”
结束
结束
函数love.draw()
love.graphics.print(fsdefault,440160)
爱。图形。绘画(拉罗,425163)
爱。图形。绘画(拉罗,470163)
结束
请注意,为了清晰起见,您应该只在love.draw
中执行屏幕绘制操作
另外,尽量避免在
love.update
中声明函数。这段代码片段将让爱重新定义你游戏中的每一帧 x>424和x<335
。选择一个x
。它会同时满足这两个条件吗?对不起。本来应该是435。原帖已编辑
local fsdefault = ""
function love.mousepressed( x, y)
if x > 424 and x < 435 and y > 161 and y < 172 then
fsdefault = "No"
end
if x > 275 and x < 320 and y > 305 and y < 325 then
fsdefault = "Yes"
end
end
function love.draw()
love.graphics.print(fsdefault, 440, 160)
love.graphics.draw(larrow, 425, 163)
love.graphics.draw(rarrow, 470, 163)
end