日期:2014-05-18  浏览次数:20744 次

小型游戏中怎样记录怪物移动的位置
今天做一个小型游戏遇到一个问题:怎样记录怪物移动的位置。我已经创建了一个英雄类(Hero)和怪物类(turtleMonster).具体情形是怎样的:当单击“怪物移动”按钮时,怪物移动到英雄的面前。这时需要记录怪物移动的位置。怪物和英雄的原始位置是:
originalLocation,当前位置是:currentLocation.英雄和怪物的高度是height.题目中给出的这段代码是:
this.currentLocation = new point(hero.originalLocation.x,hero.originalLocation.y-hero.size.height)
这是什么意思呢?我是一个.net初学者,请各位指教!

------解决方案--------------------
this.currentLocation = new point(hero.originalLocation.x,hero.originalLocation.y-hero.size.height) 
this.currentLocatio【设置怪物的坐标为】new point【新建坐标】(hero.originalLocation.x【英雄的x坐标】,originalLocation.y-hero.size.height【英雄的y坐标减去英雄的高度,结果应该是和英雄在同个水平线】)