AnAl - 奇怪的旋转
问题描述:
我对编程完全陌生。我已经测试过如何编写其他类似的东西......但我尝试在我的“游戏”中使用动画。我使用了“AnAl”库。一切都很好。但是之后我喜欢用“移动”(或者它叫做P),动画不起作用,字符旋转。我不知道我需要做什么...... 我用了Lua语言,顺便说一句。AnAl - 奇怪的旋转
require ("AnAl")
function love.load()
-- Shortcuts
lg = love.graphics
lkid = love.keyboard.isDown
local img = lg.newImage ("img.png")
anim = newAnimation(img, 100, 100, 0.1,5,0)
image = {
x = 250,
y = 150,
rotation = math.rad (0),
moveSpeed = 200
}
end
function love.draw()
anim:draw(figur, image.x, image.y, image.rotaion, 0.5, 0.5)
end
function love.update(dt)
if lkid("w") then image.y = image.y - image.moveSpeed * dt end
if lkid("s") then image.y = image.y + image.moveSpeed * dt end
if lkid("a") then image.x = image.x - image.moveSpeed * dt end
if lkid("d") then image.x = image.x + image.moveSpeed * dt end
anim:update(dt)
end
答
我不知道figur在代码中指的是什么。
anim的参数:draw应该是x,y,rotation,scalex,scaley。既然你因为某些原因在参数前加了figur,你就把旋转设置为y的位置。
anim:draw(image.x, image.y, image.rotation, 0.5, 0.5)