编辑环境 vsCode + love2D support(vsCode的插件) + love2D(c++写的运行lua游戏的一个引擎)udemy一个课介绍的
function love.load() ---love 的载入
button = {}
button.x = 200
button.y = 200
button.size = 50
score = 0
timer = 10
gameState = 1 --2 为开始 1 为关闭状态
myFont = love.graphics.newFont(40)--设置字体
end
function love.update(dt) --delt time every frame --每dt 的更新
if gameState == 2 then --2 为开始状态
if timer > 0 then
timer = timer -dt
end
if timer < 0 then --时间为0后状态调整为关闭
timer = 0
gameState = 1
end
end
end
function love.draw() --每帧的画
-- love.graphics.setColor(0,0,1) --love 11.0
-- love.graphics.rectangle("fill",200,400,200,100) --draw order
if gameState == 2 then
love.graphics.setColor(1,0,0)
love.graphics.circle("fill",button.x,button.y,button.size)
end
love.graphics.setFont(myFont)
love.graphics.setColor(1,1,1)
love.graphics.p