So, simply, I'm trying to get this obstacle moving, but I can't get it to display the changes on the scene. I have the code here for the obstacle:
`local pd = playdate
local gfx = pd.graphics
local enemySpeed = 3
local enemyStartAndMove = 400
class('Enemy').extends(gfx.sprite)
function Enemy:init(x, y, r)
Circle.super.init(self)
self:moveTo(x, y)
local circleImage = gfx.image.new("images/badguy")
self:setImage(circleImage)
end
function Enemy:update()
Enemy.super.update(self)
self.x -= enemySpeed
print(self.x)
end
`
That prints the changes as slowly decending, but I need it to be registered in the scene.
function pd.update()
gfx.sprite.update()
local crankAngle = math.rad(pd.getCrankPosition())
playerX += math.sin(crankAngle) * playerSpeed
playerY -= math.cos(crankAngle) * playerSpeed
playerX += math.sin(crankAngle)
gfx.fillCircleAtPoint(playerX, playerY, playerRadius)
end
initialize()
I need the enemy to be updated on its own and move to the left. Any help is appreciated.