Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import android.graphics.Bitmap;
- import android.graphics.Canvas;
- public class Background {
- private Bitmap image;
- private int x, y, dx;
- public Background(Bitmap res)
- {
- image = res;
- }
- public void update()
- {
- x+=dx;
- if(x<-GamePanel.WIDTH){
- x=0;
- }
- }
- public void draw(Canvas canvas)
- {
- canvas.drawBitmap(image, x, y,null);
- if(x<0)
- {
- canvas.drawBitmap(image, x+GamePanel.WIDTH, y, null);
- }
- }
- public void setVector(int dx)
- {
- this.dx = dx;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement