i was taking GD50 (cs50 game dev course) lecture 1 (flappy bird) and i encountered this error: Error
Bird.lua:19: attempt to index field 'wasPressed' (a function value)
bird = Class{}
local GRAVITY = 19.5
function bird:init()
self.image = love.graphics.newImage('bird.png')
self.width = self.image:getWidth()
self.height = self.image:getHeight()
self.x = VIRTUAL_WIDTH / 2 - (self.width / 2)
self.y = VIRTUAL_HEIGHT / 2 - (self.height / 2)
self.dy = 0
end
function bird:update(dt)
self.dy = self.dy + GRAVITY * dt
if love.keyboard.wasPressed['space'] then
self.dy = -5
end
self.y = self.y + self.dy
end
function bird:render()
love.graphics.draw(self.image, self.x, self.y)
end