Hello,
My method function "move(obj)" does nothing when it is called. The obj.pos is left unchanged. Can anyone tell me what I'm doing wrong? Here's the class code:
classdef ball
properties pos vel rad end methods function obj = ball(pos,vel,rad) if nargin ~= 0 obj=ball; obj.pos = pos; obj.vel = vel; obj.rad = rad; end end function draw(obj) (...) end function move(obj) obj.pos(1)=obj.pos(1)+obj.vel(1); obj.pos(2)=obj.pos(2)+obj.vel(2); end end
end
Thanks!
-Jim
Best Answer