【问题标题】:Slick tiledmap render explanationSlick tiledmap 渲染说明
【发布时间】:2015-09-09 12:30:00
【问题描述】:

我正在尝试为我正在使用 slick 类的平铺地图制作的游戏渲染地图,但我在理解参数 x 和 y 之间的区别时遇到了很多麻烦。以下是谷歌搜索的解释,但我不明白它

public void render(int x,
               int y,
               int sx,
               int sy,
               int width,
               int height)
Render a section of the tile map
Parameters:
x - The x location to render at
y - The y location to render at
sx - The x tile location to start rendering
sy - The y tile location to start rendering
width - The width of the section to render (in tiles)
height - The height of the secton to render (in tiles)

我的游戏由一辆汽车和一个锁定在其上的摄像头组成,该摄像头将在地图上跟随汽车四处走动。随着汽车的移动,地图开始渲染。有人可以解释一下 x 和 y 以及 sx 和 sy 如何适用于此。

【问题讨论】:

    标签: java render slick


    【解决方案1】:

    render 函数采用 tiles 的矩形区域并将它们绘制到屏幕上 pixels 的矩形区域上。

    • xy指定像素矩形的左上角

    • sxsy 指定平铺矩形的左上角

    • widthheight指定平铺矩形的面积

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-23
      • 1970-01-01
      • 1970-01-01
      • 2016-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多