Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Bullet {
- private Rectangle rect;
- private float velocity;
- public Bullet(Rectangle rect, float velocity) {
- this.rect = rect;
- this.velocity = velocity;
- }
- public void updateRight() {
- rect.x += velocity;
- }
- public void updateLeft() {
- rect.x -= velocity;
- }
- public Rectangle getRect() {
- return rect;
- }
- public float getVelocity() {
- return velocity;
- }
- }
- if (arrayBullet.size != 0) {
- for (num = 0; num < arrayBullet.size; num++) {
- if (isFire) {
- arrayBullet.get(num).updateRight();
- }
- if (!isFire) {
- arrayBullet.get(num).updateLeft();
- }
- byte i = 0;
- if(facesRight){
- isFire=true;
- }
- else {
- isFire=false;
- }
- 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