Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. attacktimer = new javax.swing.Timer(3000, new ActionListener() {
  2. public void actionPerformed(ActionEvent e){
  3. bp = new BeeProjectile();
  4. bp.setX(x);
  5. bp.setY(y);
  6. deltaX = (int) ((int) ((Game.px + 40) - x));
  7. deltaY = (int) ((int) ((Game.py + 75) - y));
  8. direction = Math.atan2(deltaY,deltaX);
  9. speed = 13.0;
  10. beemove.start();
  11. restarttimer.start();
  12. }
  13. });
  14. attacktimer.setRepeats(false);
  15. beemove = new javax.swing.Timer(50, new ActionListener() {
  16. public void actionPerformed(ActionEvent e){
  17. bp.setX(bp.getX() + (speed * Math.cos(direction)));
  18. bp.setY(bp.getY() + (speed * Math.sin(direction)));
  19. bpxint = (int) bp.getX();
  20. bpyint = (int) bp.getY();
  21.  
  22. }
  23. });
  24. restarttimer = new javax.swing.Timer(3000, new ActionListener() {
  25. public void actionPerformed(ActionEvent e){
  26.  
  27. attacktimer.start();
  28. restarttimer.start();
  29.  
  30. }
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement