Loading app/src/main/java/com/example/a8_bitinvader/Projectile.javadeleted 100644 → 0 +0 −50 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 Projectile { private int velocity; int xPos; int yPos; Bitmap bulletImage; private final int bulletHeight = 100, bulletWidth = 30; /** * Projectiles from player only go upward * @param velocity of the projectile */ public Projectile(int xPos, int yPos, int velocity, Resources res) { this.xPos = xPos; this.yPos = yPos; bulletImage = BitmapFactory.decodeResource(res, R.drawable.bullet); bulletImage = Bitmap.createScaledBitmap(bulletImage, bulletHeight, bulletWidth, false); this.velocity = velocity; } /** * * @return Velocity of projectile */ public int getVelocity() { return velocity; } /** * Checks if the * @param xx X coordinate to check collision * @param yy Y coordinate to check collision * @return True if the bullet has connected with a {@link Sprite} */ public boolean checkForCollision(int xx, int yy) { if((xx < (xPos+bulletWidth) && xx > xPos) && (yy < (yPos+bulletHeight) && yy > yPos)) { return true; } return false; } } Loading
app/src/main/java/com/example/a8_bitinvader/Projectile.javadeleted 100644 → 0 +0 −50 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 Projectile { private int velocity; int xPos; int yPos; Bitmap bulletImage; private final int bulletHeight = 100, bulletWidth = 30; /** * Projectiles from player only go upward * @param velocity of the projectile */ public Projectile(int xPos, int yPos, int velocity, Resources res) { this.xPos = xPos; this.yPos = yPos; bulletImage = BitmapFactory.decodeResource(res, R.drawable.bullet); bulletImage = Bitmap.createScaledBitmap(bulletImage, bulletHeight, bulletWidth, false); this.velocity = velocity; } /** * * @return Velocity of projectile */ public int getVelocity() { return velocity; } /** * Checks if the * @param xx X coordinate to check collision * @param yy Y coordinate to check collision * @return True if the bullet has connected with a {@link Sprite} */ public boolean checkForCollision(int xx, int yy) { if((xx < (xPos+bulletWidth) && xx > xPos) && (yy < (yPos+bulletHeight) && yy > yPos)) { return true; } return false; } }