protected void onDraw(Canvas canvas)
{
if (x == getWidth() - bmp.getWidth())
{
xSpeed = -1;
}
if (x == 0)
{
xSpeed = 1;
}
x = x + xSpeed;
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(bmp, x , 10, null);
}
Let’s say x = 0 and xSpeed = 1,how does it work
Please explain this to me.
flow of excution is always top to buttom.So you can see your code how it will execute.