Commit eedff5c8 authored by Thomas Poimenidis's avatar Thomas Poimenidis
Browse files

implemented Bullet class

parent c8ef4ed8
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
package com.example.a8_bitinvader;


import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Bullet extends Sprite {

    /**
     * Creates Bullet object using Sprite constructor
     */
    public Bullet(int xPos, int yPos, int xVel, int yVel, Resources res) {
        super(xPos, yPos, xVel, yVel);
        spriteImage = BitmapFactory.decodeResource(res, R.drawable.red);
        spriteImage = Bitmap.createScaledBitmap(spriteImage, screenWidth, screenHeight, false);
    }

}
+0 −28
Original line number Diff line number Diff line
package com.example.a8_bitinvader;


public class Projectile {
    private int velocity;
    int x;
    int y;
    int image;
    int screenW;
    int screenH;


    /**
     * Projectiles from player only go upward
     * @param velocity of the projectile
     */
    public Projectile(int xp, int yp, int img, int velocity) {
        this.velocity = velocity;
    }

    /**
     *
     * @return Velocity of projectile
     */
    public int getVelocity() {
        return velocity;
    }
}