Minor adjustments
parent
f6fe5def83
commit
21edb5f4f4
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -143,10 +143,10 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
|
||||||
move();
|
move();
|
||||||
checkCollision();
|
checkCollision();
|
||||||
repaint();
|
repaint();
|
||||||
if (frameCounter > 10) {
|
if (frameCounter > 5) {
|
||||||
// increment sprite image to be used and keeps it below 12
|
// increment sprite image to be used and keeps it below 12
|
||||||
frame = (frame + 1) % 11;
|
frame = (frame + 1) % 11;
|
||||||
frameCounter -= 10;
|
frameCounter -= 5;
|
||||||
}
|
}
|
||||||
delta--;
|
delta--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class Player extends GenericSprite {
|
||||||
public int draw(Graphics g, int frame) {
|
public int draw(Graphics g, int frame) {
|
||||||
// g.setColor(Color.WHITE);
|
// g.setColor(Color.WHITE);
|
||||||
if (!upPressed && !downPressed && !leftPressed && !rightPressed) {
|
if (!upPressed && !downPressed && !leftPressed && !rightPressed) {
|
||||||
g.drawImage(spriteArray[lastXDirection][lastYDirection][lastFrame], x, y, null);
|
g.drawImage(spriteArray[lastXDirection][lastYDirection][0], x, y, null);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
lastXDirection = (int)(Math.signum(xVelocity) + 1) / 2;
|
lastXDirection = (int)(Math.signum(xVelocity) + 1) / 2;
|
||||||
|
|
Loading…
Reference in New Issue