protected boolean isOutsidePlayfield() { final int width = GameView.this.getWidth(); final int height = GameView.this.getHeight(); return mPositionX < 0 || mPositionX >= width || mPositionY < 0 || mPositionY >= height; }
protected boolean isOutsidePlayfield() { final int width = GameView.this.getWidth(); final int height = GameView.this.getHeight(); return mPositionX < 0 || mPositionX >= width || mPositionY < 0 || mPositionY >= height; }
protected void wrapAtPlayfieldBoundary() { final int width = GameView.this.getWidth(); final int height = GameView.this.getHeight(); while (mPositionX <= -mSize) { mPositionX += width + mSize * 2; } while (mPositionX >= width + mSize) { mPositionX -= width + mSize * 2; } while (mPositionY <= -mSize) { mPositionY += height + mSize * 2; } while (mPositionY >= height + mSize) { mPositionY -= height + mSize * 2; } }
protected void wrapAtPlayfieldBoundary() { final int width = GameView.this.getWidth(); final int height = GameView.this.getHeight(); while (mPositionX <= -mSize) { mPositionX += width + mSize * 2; } while (mPositionX >= width + mSize) { mPositionX -= width + mSize * 2; } while (mPositionY <= -mSize) { mPositionY += height + mSize * 2; } while (mPositionY >= height + mSize) { mPositionY -= height + mSize * 2; } }
public Ship() { mPaint = new Paint(); mPaint.setStyle(Style.FILL); setPosition(getWidth() * 0.5f, getHeight() * 0.5f); setVelocity(0, 0); setSize(mShipSize); mPath = new Path(); mPath.moveTo(0, 0); mPath.lineTo((float)Math.cos(-CORNER_ANGLE) * mSize, (float)Math.sin(-CORNER_ANGLE) * mSize); mPath.lineTo(mSize, 0); mPath.lineTo((float)Math.cos(CORNER_ANGLE) * mSize, (float)Math.sin(CORNER_ANGLE) * mSize); mPath.lineTo(0, 0); }
public Ship() { mPaint = new Paint(); mPaint.setStyle(Style.FILL); setPosition(getWidth() * 0.5f, getHeight() * 0.5f); setVelocity(0, 0); setSize(mShipSize); mPath = new Path(); mPath.moveTo(0, 0); mPath.lineTo((float)Math.cos(-CORNER_ANGLE) * mSize, (float)Math.sin(-CORNER_ANGLE) * mSize); mPath.lineTo(mSize, 0); mPath.lineTo((float)Math.cos(CORNER_ANGLE) * mSize, (float)Math.sin(CORNER_ANGLE) * mSize); mPath.lineTo(0, 0); }