Commit c7f5859f authored by Jiawei  Xiang's avatar Jiawei Xiang
Browse files

General function for player and Enemy

parent c524a53d
Loading
Loading
Loading
Loading
+26 −0
Original line number Original line Diff line number Diff line
package com.example.a8_bitinvader;

public class Enemy extends Sprite{
    int XVal,YVal;

    //initialize the Xval,Yval. and inital position
    public Enemy(int PosX, int PosY, int theXVal, int theYVal, int img ) {
        super(PosX,PosY,img);
        XVal = theXVal;
        YVal = theYVal;
    }

    //this updates the location of the sprite
    @Override
    public void updateLocation(){
        x += XVal;
        y += YVal;
    }


    @Override
    public void destroy() {
        //call the distroy functions, then delete this.
    }

}
Loading