Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. //Vardas pavarde
  2. import ptmx.*;
  3. Ptmx map;
  4. int x, y;
  5. PImage marioImg;
  6. PImage[] marioImgArray;
  7. void setup() {
  8. size(1000, 480);
  9. map = new Ptmx(this, "level3.tmx");
  10. marioImg = loadImage("Mario_and_Enemies.png");
  11. marioImgArray = new PImage[6];
  12. }
  13.  
  14. void draw()
  15. {
  16. map.draw(x, y);
  17. moveWorld();
  18. drawMario();
  19. }
  20. void drawMario()
  21. {
  22. PImage mariosmall;
  23.  
  24. for(int i= 0 ;i<6;i++)
  25. {
  26. mariosmall = marioImg.get(1+i*16, 30, 16, 30);
  27. image(mariosmall, 30+i*100, 300, 50, 80);
  28. }
  29.  
  30. }
  31.  
  32.  
  33.  
  34. void moveWorld()
  35. {
  36. if(keyPressed)
  37. {
  38. if(key=='a' || key=='A')
  39. {
  40. x = x - 16;
  41. }
  42. if(key=='d' || key=='D')
  43. {
  44. x = x+ 16;
  45. }
  46. if(key=='w' || key=='W')
  47. {
  48. y = y-16;
  49. }
  50. if(key=='s' || key=='S')
  51. {
  52. y = y+16;
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement