Hi, I’m having a problem with hitTestPoint. Apparently I don’t know how to use it. The code below (which is the entire code in the project) works fine as long as the two commented lines are commented out. It loads normally and if I click anywhere, the print function prints out as expected.
If I uncomment those two lines, the program runs fine at first, but if I click on the image I get:
main.lua:3: attempt to index local 'event' (a nil value)
main.lua:3: in function
I don’t understand why there are no values for “event”. Can someone help?
local image1 = Bitmap.new(Texture.new("images/randy.png", true))
--if image1:hitTestPoint(event.x, event.y) then
Option 1, turn ':' into '.' on the handler
I've always had problems knowing the difference bewteen the dot operator and the colon operator - instance vs method stuff. I guess I need to read about those again in the lua documentation.
Likes: SinisterSoft, Apollo14, antix