| 
 
| 赞 | 0 |  
| VIP | 22 |  
| 好人卡 | 2 |  
| 积分 | 1 |  
| 经验 | 12544 |  
| 最后登录 | 2017-9-7 |  
| 在线时间 | 380 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间380 小时注册时间2010-8-11帖子68 | 
| def update_move distance = 2 ** @move_speed   # 转换成移动距离
 distance *= 2 if dash?        # 跑步中加倍
 @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
 @real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
 @real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
 @real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
 update_bush_depth unless moving?
 if @walk_anime
 @anime_count += 1.5
 elsif @step_anime
 @anime_count += 1
 end
 end
 以上是来自Game_character的一部分代码
 @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
 比如这句话,
 @real.x 后面的算式得到的值是怎样计算的?
 
 还有一个问题就是
 self 这个伪变量指的是“当前方法的执行对象本身”
 我知道 a= b.c
 def b
 self.c = 1
 end
 p a      a=> 1
 除此以外self还有什么其他的用法吗 ?
 | 
 |