擅长:python、mysql、java
<p>关于摄像机:
在我看来,相机最简单的实现方式是a相机xoffset和camera yoffset。如果它被设置在x+y位置,则应将其设置为x+y位置</p>
<p>现在,如果我们希望玩家处于player_x位置,player_y位于屏幕中心,在每次迭代中:</p>
<p>我们正常更新播放器</p>
<p>我们将xoffset和yoffset设置为:
xoffset=屏幕宽度/2-播放器
yoffset=屏幕高度/2-播放器</p>
<p>我们画了所有的精灵(包括玩家)
在位置sprite_x+x偏移,sprite_y+y偏移</p>
<p>冲洗并重复。我希望这有帮助:)</p>