public BattaSprite(Context context) { Resources res = context.getResources(); int currentBird = random.nextInt(DRAWABLE_BIRD.length); birds[0] = birds[2] = res.getDrawable(DRAWABLE_BIRD[currentBird][0]); birds[1] = res.getDrawable(DRAWABLE_BIRD[currentBird][1]); birds[3] = res.getDrawable(DRAWABLE_BIRD[currentBird][2]); birdHeight = ViewUtil.dipResourceToPx(context, R.dimen.bird_height); birdWidth = birdHeight * birds[0].getIntrinsicWidth() / birds[0].getIntrinsicHeight(); width = ViewUtil.getScreenWidth(context); height = ViewUtil.getScreenHeight(context); int xPosition = ViewUtil.dipResourceToPx(context, R.dimen.bird_position_x); X = width / 2 - birdWidth / 2 - xPosition; currentHeight = height / 2 - birdHeight / 2; acceleration = ViewUtil.dipResourceToFloat(context, R.dimen.bird_acceleration); tapSpeed = ViewUtil.dipResourceToFloat(context, R.dimen.bird_tap_speed); maxHeight = height - ViewUtil.dipResourceToPx(context, R.dimen.ground_height); hitPaddingBottom = ViewUtil.dipResourceToPx(context, R.dimen.bird_hit_padding_bottom); hitPaddingTop = ViewUtil.dipResourceToPx(context, R.dimen.bird_hit_padding_top); hitPaddingLeft = ViewUtil.dipResourceToPx(context, R.dimen.bird_hit_padding_left); hitPaddingRight = ViewUtil.dipResourceToPx(context, R.dimen.bird_hit_padding_right); currentSpeed = 0; }