Loading app/src/main/java/com/example/a8_bitinvader/GameView.java +2 −2 Original line number Diff line number Diff line Loading @@ -71,8 +71,8 @@ public class GameView extends SurfaceView implements Runnable{ if(background2.yPos > screenHeight) { background2.yPos = -screenHeight; } p1.xVel = (int)joystick.XVelocity* p1.SPEEDMULTIPLIER; p1.yVel = (int)joystick.YVelocity* p1.SPEEDMULTIPLIER; p1.xVel = (int)joystick.XVelocity* p1.SPEED_MULTIPLIER; p1.yVel = (int)joystick.YVelocity* p1.SPEED_MULTIPLIER; p1.update(); joystick.update(joystick); } Loading app/src/main/java/com/example/a8_bitinvader/Player.java +13 −2 Original line number Diff line number Diff line Loading @@ -10,14 +10,25 @@ import android.util.Log; public class Player extends Sprite{ /** Health of player */ private int health = 3; public final int SPEEDMULTIPLIER = 5; /** Speed */ public final int SPEED_MULTIPLIER = 5; /** * Constructs a new player at given coordinates and * @param xPos Xposition of player * @param yPos Y position of player * @param xVel X velocity of player * @param yVel Y velocity of player * @param res Resource object */ public Player(int xPos, int yPos, int xVel, int yVel, Resources res) { super(xPos,yPos,xVel,yVel); this.xPos = xPos; this.yPos = yPos; spriteImage = BitmapFactory.decodeResource(res, R.drawable.green64); spriteImage = BitmapFactory.decodeResource(res, R.drawable.player); spriteImage = Bitmap.createScaledBitmap(spriteImage, getSpriteWidth(), getSpriteHeight(), false); } Loading Loading
app/src/main/java/com/example/a8_bitinvader/GameView.java +2 −2 Original line number Diff line number Diff line Loading @@ -71,8 +71,8 @@ public class GameView extends SurfaceView implements Runnable{ if(background2.yPos > screenHeight) { background2.yPos = -screenHeight; } p1.xVel = (int)joystick.XVelocity* p1.SPEEDMULTIPLIER; p1.yVel = (int)joystick.YVelocity* p1.SPEEDMULTIPLIER; p1.xVel = (int)joystick.XVelocity* p1.SPEED_MULTIPLIER; p1.yVel = (int)joystick.YVelocity* p1.SPEED_MULTIPLIER; p1.update(); joystick.update(joystick); } Loading
app/src/main/java/com/example/a8_bitinvader/Player.java +13 −2 Original line number Diff line number Diff line Loading @@ -10,14 +10,25 @@ import android.util.Log; public class Player extends Sprite{ /** Health of player */ private int health = 3; public final int SPEEDMULTIPLIER = 5; /** Speed */ public final int SPEED_MULTIPLIER = 5; /** * Constructs a new player at given coordinates and * @param xPos Xposition of player * @param yPos Y position of player * @param xVel X velocity of player * @param yVel Y velocity of player * @param res Resource object */ public Player(int xPos, int yPos, int xVel, int yVel, Resources res) { super(xPos,yPos,xVel,yVel); this.xPos = xPos; this.yPos = yPos; spriteImage = BitmapFactory.decodeResource(res, R.drawable.green64); spriteImage = BitmapFactory.decodeResource(res, R.drawable.player); spriteImage = Bitmap.createScaledBitmap(spriteImage, getSpriteWidth(), getSpriteHeight(), false); } Loading