Log In  
Follow
Thiskul

huge nerd

all pronouns


Cart #jegurokug-1 | 2022-10-22 | Code ▽ | Embed ▽ | No License

Hello, im wondering why the velocity and acceleration (vx and va) dont go to zero when you go left then let go.
Also note that the maximums are different.

Controls:
Left -- go left
Right -- go right
X -- force vx and va values to zero

is this just a quirk with pico-8?

Thanks :)

Code:
[hidden]

function _init()
x=0
vx=0
ax=0
end

function _update60()
	if btn(➡️) then
		ax+=.01
	end
	if btn(⬅️) then
		ax-=.01
	end
	if btn(❎) then
		ax=0
		vx=0
	end

	vx+=ax
	x+=vx

	vx*=.9
	ax*=.9
end

function _draw()
	cls()
	line(x,0,x,127,7)

	print(vx.." velocity",0,0,2)
	print(ax.." acceleration")
	print(x.." x")

end

[ Continue Reading.. ]

3 comments