Guest User

Untitled

a guest
Dec 5th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public class Bullet {
  2. private Rectangle rect;
  3. private float velocity;
  4.  
  5. public Bullet(Rectangle rect, float velocity) {
  6. this.rect = rect;
  7. this.velocity = velocity;
  8. }
  9.  
  10. public void updateRight() {
  11. rect.x += velocity;
  12. }
  13.  
  14. public void updateLeft() {
  15. rect.x -= velocity;
  16. }
  17.  
  18. public Rectangle getRect() {
  19. return rect;
  20. }
  21.  
  22. public float getVelocity() {
  23. return velocity;
  24. }
  25. }
  26.  
  27. if (arrayBullet.size != 0) {
  28. for (num = 0; num < arrayBullet.size; num++) {
  29. if (isFire) {
  30. arrayBullet.get(num).updateRight();
  31. }
  32. if (!isFire) {
  33. arrayBullet.get(num).updateLeft();
  34. }
  35.  
  36. byte i = 0;
  37. if(facesRight){
  38. isFire=true;
  39. }
  40. else {
  41. isFire=false;
  42. }
  43.  
  44. arrayBullet.add(new Bullet(new Rectangle(position.x, position.y + 0.3f, 0.7f, 0.7f), 0.3f));
Add Comment
Please, Sign In to add comment