我目前正在使用Libgdx创建游戏。我的问题是为什么我的地图仅渲染图块而不是实际图块,这是屏幕截图的链接:
如您在图片中所见,box2drenderer正常工作,但地图未显示,而是仅显示了所使用图块中的“碎片”。
编辑:解决方案是单击Tiled中的“嵌入式tileet”,这与代码无关。
公共类WorldMap {
data = pd.DataFrame({
'Transaction Date':pd.to_datetime(['09/03/2019','09/20/2019','08/25/2019',
'08/25/2019','08/26/2019', '06/10/2019']),
'Amount':[7,8,9,4,2,3],
'Category':list('aaabbb')
})
print (data)
Transaction Date Amount Category
0 2019-09-03 7 a
1 2019-09-20 8 a
2 2019-08-25 9 a
3 2019-08-25 4 b
4 2019-08-26 2 b
5 2019-06-10 3 b
df = data.set_index('Transaction Date').groupby('Category').resample("M").sum()
print (df)
Amount
Category Transaction Date
a 2019-08-31 9
2019-09-30 15
b 2019-06-30 3
2019-07-31 0
2019-08-31 6
data = data.set_index('Transaction Date')
df = data.groupby(['Category', pd.Grouper(freq='M')]).sum()
print (df)
Amount
Category Transaction Date
a 2019-08-31 9
2019-09-30 15
b 2019-06-30 3
2019-08-31 6
}
公共类GameScreen实现屏幕{
private GameScreen gameScreen ;
private Rectangle bounds ;
public WorldMap(GameScreen gameScreen){
this.gameScreen = gameScreen ;
World world = gameScreen.getWorld() ;
createMap(world) ;
}
private void createMap(World world) {
BodyDef bodyDef = new BodyDef() ;
PolygonShape shape = new PolygonShape() ;
FixtureDef fixtureDef = new FixtureDef() ;
Body body ;
// ground
for (MapObject object : gameScreen.getTiledMap().getLayers().get(2).getObjects().getByType(RectangleMapObject.class)){
bounds= ((RectangleMapObject)object).getRectangle();
bodyDef.type = BodyDef.BodyType.StaticBody ;
bodyDef.position.set(
(bounds.getX() + bounds.getWidth() /2f ) / GameInfo.PPM,
(bounds.getY() + bounds.getHeight() /2f) / GameInfo.PPM
);
body = gameScreen.getWorld().createBody(bodyDef) ;
shape.setAsBox(bounds.getWidth()/2f / GameInfo.PPM , bounds.getHeight() /2f / GameInfo.PPM);
fixtureDef.shape = shape ;
Fixture fixture = body.createFixture(fixtureDef);
}