I have no working code at all, but I'll post my method of display the image I need to bobble.
public void onDraw(Canvas can){
can.drawBitmap(bobbleHead , xpos, ypos, p);
}
I have xpos and ypos declared.
I have no working code at all, but I'll post my method of display the image I need to bobble.
public void onDraw(Canvas can){
can.drawBitmap(bobbleHead , xpos, ypos, p);
}
I have xpos and ypos declared.
If all you want is for the head to move up and down, you need to use a sin
function to modify ypos. For example, if you want the head to bob up and down once a second, you can calculate ypos using the time in seconds:
time = now - start;
ypos = ypos_at_rest + ypos_extension * sin(time * pi * 2.0);
Forgive me if the syntax is a little off, I'm extrapolating Java from C.