Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. package Part_1;
  2.  
  3. public class Projectile extends Thread {
  4.  
  5. int x;
  6. int y;
  7.  
  8. int dx = 1;
  9. int dy = 7;
  10. int explodeTime = 15;
  11.  
  12.  
  13. public void run() {
  14.  
  15. while (true) {
  16.  
  17. try {
  18. Thread.sleep(1000);
  19. } catch (InterruptedException e) {
  20. // TODO Auto-generated catch block
  21. e.printStackTrace();
  22. }
  23.  
  24. // Move forward
  25. x = x + dx;
  26. y = y + dy;
  27.  
  28. dy = dy -1;
  29. if (y == 0) {
  30.  
  31. ////////////
  32. }
  33. // if (x = 15) or (y = 15) {
  34. // x = 0; y = 0;
  35. // }
  36. }
  37. }
  38.  
  39.  
  40. public void explode() {
  41. System.out.println("EXPLOSION");
  42.  
  43. }
  44.  
  45. public void reset() {
  46. dy = 0;
  47. dx = 0;
  48. }
  49.  
  50. public String t0String() {
  51. return "X="+x+" y="+y;
  52.  
  53. // if (timerSeconds
  54.  
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement