//Sprite Management// // This section handles how the player sprite is displayed. This // is done using the movement variables (dy, dx) to define // which way the player is currently facing/moving. The only // current flaw with this is that a player can move diagonally // whilst displaying a vertical/horizontal sprite. // Variables Used: dy, dx, cardinal, movementallowed if(dy == -1){ if(dy == 0 && movementallowed){ cardinal = "north.png"; }else if(!(dy == 0)){ cardinal = "north.png"; } } if(dy == 1){ if(dy == 0 && movementallowed){ cardinal = "south.png"; }else if(!(dy == 0)){ cardinal = "south.png"; } } if(dx == 1){ if(dx == 0 && movementallowed){ cardinal = "east.png"; }else if(!(dx == 0)){ cardinal = "east.png"; } } if(dx == -1){ if(dx == 0 && movementallowed){ cardinal = "west.png"; }else if(!(dx == 0)){ cardinal = "west.png"; } } ImageIcon i = new ImageIcon(cardinal); // This sets the sprite of the player according to Sprite Management still = i.getImage(); //End of//Sprite Management// } Image still; String cardinal;