Problem with analog stick
ok been looking around for info on analog stick and there's not much out there
here's my problem
I have an image with a big thick red line and a dot I am moving around with the analog stick, I use the pixel detection for this and tell it if you touch red pixel stop.
so far it works, but what I really want, and that I just can't figure out, is I want my dot not to stop but just be block from passage in the red zone.
Quote:
red = Color.new(255, 0, 0)
dot = Image.load("DATA/dot.png")
bgC = Image.load("DATA/bg col2.png")
x0 = 0 ; y0 = 0 ; x1 = 0 ; y1 = 0
while true do
screen:clear()
pad = Controls.read()
dx = pad:analogX()
if math.abs(dx) > 32 then
x0 = x0 + dx / 64
end
dy = pad:analogY()
if math.abs(dy) > 32 then
y0 = y0 + dy / 64
end
if bgC:pixel (x1, y1) == red then
x1 = x1 ; y1 = y1 else
x1 = x0 ; y1 = y0
end
screen:blit(0, 0, bgC)
screen:blit(x1, y1, dot)
screen.waitVblankStart()
screen.flip()
if pad:start() then break end
end
so if someone could help it be appreciate