Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. public Image Saute(){
  2.  
  3.  
  4. ImageIcon ico;
  5. Image img;
  6. String str;
  7.  
  8. // Montée du saut //
  9.  
  10.  
  11. this.compteurSaut ++;
  12.  
  13. if(this.compteurSaut <= 35){
  14.  
  15. if(this.getY() > Main.scene.getyPlafond()){
  16.  
  17. this.setY(this.getY() - 4);
  18. }else{
  19.  
  20. this.compteurSaut = 36;
  21. }
  22.  
  23. if(this.isVersDroite()){
  24.  
  25. str = "/images/marioSautDroite.png";
  26. }else{
  27.  
  28. str = "/images/marioSautGauche.png";
  29. }
  30.  
  31. // Retombée du saut //
  32. }else if(this.getY() + this.getHauteur() < Main.scene.getySol()){
  33.  
  34. this.setY(this.getY() + 1);
  35.  
  36. if(this.isVersDroite()){
  37. str = "/images/marioSautGauche.png";
  38. }else{
  39. str = "/images/marioSautGauche.png";
  40. }
  41.  
  42. // Saut terminée //
  43.  
  44. }else{
  45.  
  46. if(this.isVersDroite() == true){
  47.  
  48. str = "/images/marioArretDroite.png";
  49.  
  50. }else{
  51.  
  52. str = "/images/marioArretGauche.png";
  53.  
  54. }
  55.  
  56. this.saut = false;
  57. this.compteurSaut = 0;
  58.  
  59. }
  60.  
  61.  
  62. //Affichage
  63.  
  64. ico = new ImageIcon(getClass().getResource(str));
  65. img = ico.getImage();
  66. return img;
  67.  
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement