cxzheng123在上个帖子中说
引用:
做了个小例子,通过控制loc的变换来控制物体的移动,可以通过调节Speed的值来控制移动速度。有点问题:
1:由于取整误差,使终点位置偏离了希望的位置;
2:如果我要实现物体在终点停顿3秒再向下一个目标移动,怎么在这帧里写程序?
多谢各位大虾了。。。。。
1、取整误差可以在最后修正:
global py,Speed
on exitFrame me
Speed=5
py=abs((377-86).float / (497-126).float)
if sprite(1).locH < 497 then
if sprite(1).loch+speed<497 then
set the loc of sprite 1 to point ( (the loch of sprite 1)+Speed , (the locv of sprite 1)+integer(Speed*py))
else
set the loc of sprite 1 to point(497,(the locv of sprite 1)+integer(speed*py))
end if
end if
go the frame
end