File size: 701 Bytes
f3382b1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | local Avatar = require("Avatar")
local player = Avatar:new{
name = "Sven",
x = 100,
y = 100,
speed = 150,
frameSpeed = 0.08,
sprite = nil, -- später Sprite-Objekt setzen
animations = {
-- z.B. "walk_down" = {quad1, quad2, quad3, ...}
}
}
-- In deinem Update-Loop
function update(dt)
local dx, dy = 0, 0
-- Beispiel Input (Pseudo-Code)
if isKeyDown("left") then dx = dx - 1 end
if isKeyDown("right") then dx = dx + 1 end
if isKeyDown("up") then dy = dy - 1 end
if isKeyDown("down") then dy = dy + 1 end
player:move(dx, dy, dt)
player:update(dt)
end
-- In deinem Render-Loop
function draw()
player:draw()
end
|