The following code only checks for collision with the vertical walls .
using Javis
video = Video(500,500)
nframes=250
Background(1:nframes, (v,o,f)-> background("white"))
obj = Object(1:nframes , (v,o,f)-> begin
circle(O,50,:fill)
return O
end)
obj.opts[:velocity] = (10,1)
#not really an obj , as in draws nothing , but runs a function
updaterobj = Object(1:nframes , (v,o,f) -> begin
#hardcoded boundaries of the video
if !(-250+25 < get_position(obj).x < 250-25)
v = obj.opts[:velocity]
obj.opts[:velocity] = (-v[1],v[2])
end
end)
move() = (v,o,a,f)-> begin
if f == 1
#need this if since get_position doesnt work on frame 1
translate(o.start_pos + o.opts[:velocity] )
else
translate(get_position(o) + o.opts[:velocity] )
end
end
act!(obj , Action(1:nframes,move()))
render(video,pathname="vid.mp4")
run(`mpv vid.mp4`)