/** with this method we can obtain static obstacle from pool */ public synchronized StaticObstacle obtainPoolItem(float x, float y) { StaticObstacle obstacle = super.obtainPoolItem(); obstacle.setPosition(x, y); obstacle.setVisible(true); obstacle.setIgnoreUpdate(false); return obstacle; }
/** this method is for handling static obstacle when recycle method called * */ @Override protected void onHandleRecycleItem(StaticObstacle obstacle) { super.onHandleRecycleItem(obstacle); obstacle.setVisible(false); obstacle.setIgnoreUpdate(true); }