Working on moving steel

master
bob 2022-06-17 13:03:38 -04:00
parent 75257a29fe
commit 63ed2e6165
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ public class Player extends GenericSprite {
public static final int PLAYER_WIDTH = 52; public static final int PLAYER_WIDTH = 52;
public static final int PLAYER_HEIGHT = 94; public static final int PLAYER_HEIGHT = 94;
public static final double reach = 0.89;
public static final int steelReachRange = 4*Tile.length; public static final int steelReachRange = 4*Tile.length;
public int lastXDirection, lastYDirection, lastFrame; public int lastXDirection, lastYDirection, lastFrame;
@ -398,7 +399,7 @@ public class Player extends GenericSprite {
public int draw(Graphics g, int frame) { public int draw(Graphics g, int frame) {
frame %= spriteArray[0][0].length; frame %= spriteArray[0][0].length;
if(rightMouseDown){ if(rightMouseDown){
g.drawOval(x+WIDTH/2-steelReachRange,y+HEIGHT/2-steelReachRange, steelReachRange*2,steelReachRange*2); g.drawOval((int)(x+WIDTH/2-(reach*steelReachRange)),(int)(y+HEIGHT/2-(reach*steelReachRange)), (int)(reach*steelReachRange*2),(int)(reach*steelReachRange*2));
} }
if (!upPressed && !downPressed && !leftPressed && !rightPressed) { if (!upPressed && !downPressed && !leftPressed && !rightPressed) {
g.drawImage(spriteArray[lastXDirection][lastYDirection][0].image, x-10, y, null); g.drawImage(spriteArray[lastXDirection][lastYDirection][0].image, x-10, y, null);