So i'm new to programming and is currently trying out coding in pico-8.
I made the start to a game where the sprite is supposed to fall down from the top, and when colliding with my pset (point), i would like my score count to go up by 1. As of now i've come across 2 different outcomes. The first where the score is going up insanely fast constantly, and one where the score goes up everytime my point goes past the sprites top left pixels y and x. I don't know how to fix it, and i really want to know whats wrong with it.
(Tab 1)
col=11
sx=40
sy=20
x=64
y=64
score=0
function _init()
cls()
end
function _update()
cls()
movement()
border()
point()
sprite1()
if (x == sx) then score +=1 end
if (y == sy) then score +=1 end
end
(Tab 2)
function _draw()
print("score:",0,0)
print(score,25,0)
end
(Tab 3)
-- movement
function point()
pset(x,y,col)
end
function movement()
if btn(⬅️) then x -= 1 end
if btn(➡️) then x += 1 end
if btn(⬆️) then y -= 1 end
if btn(⬇️) then y += 1 end
end
-- sprite1
s1=1
function sprite1()
spr(s1,sx,sy)
end
(Tab 4)
-- border
function border()
if x>=127 then y=60 end
if x<=0 then y=60 end
if y>=127 then x=60 end
if y<=0 then x=60 end
if x>=127 then x=60 end
if x<=0 then x=60 end
if y>=127 then y=60 end
if y<=0 then y=60 end
end