package com.hyperling.apps.games; import android.graphics.Bitmap; import android.graphics.Canvas; /** * Created by ling on 12/23/16. */ public abstract class EnvironmentObject extends GameObject { protected Bitmap image; public EnvironmentObject(Bitmap i, int w, int h, int x, int y){ image = i; width = w; height = h; this.x = x; this.y = y; } public void update(int gameSpeed){ // Move the object x += gameSpeed; setEndX(getX() + getWidth()); setCenterX((getX() + getEndX()) / 2); } public void draw(Canvas canvas) { // Draw the object canvas.drawBitmap(image, x, y, null); } }