Game

Hey guys, what can I do to make this game more interesting? And how do I do it? Any ideas? Thanks!

float posx = width;
float posy = height;
float velx = 5;
float vely = 2;
float baseh = 10;
float basew = 90;
int pont = 0;
int nivel = 1;

void setup() {
  size(800, 600);
  background(206, 234, 211);
}

void draw() {
  background(167, 167, 167);
  noStroke();
  posx += velx;
  posy += vely;
  fill(206, 234, 211);
  ellipse(posx, posy, 30, 30);
  fill(62, 62, 62);
  rect(mouseX, height-baseh, basew, baseh);
  textSize(15);
 textAlign(CENTER);
  fill(255);
  //text("jogos: " + score, width/2, height/4);
  fill(255);
  // text("NÍVEL " + nivel + "/3", width/2, height/2);


  if (posx>=width) {
    velx = -velx;

  } else if (posx<=0) {
    velx = +-velx;


  } else if (posy>=(height)-baseh && posx>=mouseX &&
    posx<mouseX + basew) {
    vely = -vely;

  } 

  else if (posy>=height) {
    posx = width/2;
    posy = height/2;
    pont += 5;
    velx = 5;
    vely = 2;
    nivel = 1;

  }

  else if (posy<=0) {
    vely = +-vely * 2;
  }

  if (vely>=8) {

    nivel = 2;
  } 

  else if (vely>=10) {
    nivel = 3;
  }
}
Tagged:

Answers

  • edited June 2017

    You could place bricks in the upper half that get destroyed

    Look up Arkanoid in Wikipedia

    https://en.wikipedia.org/wiki/Arkanoid

  • And removing bricks could reveal an image of an attractive person beneath them! ;-)

    Or some bricks could drop power-ups that change the game mechanics.

  • Yeah, or some are permanent so bricks behind it are harder to hit

    Different colors for bricks

    Moving bricks

    Different levels with different forms of bricks

  • edited June 2017

    Bricks that take more than a single hit.

    Bricks of different sizes.

    More than one ball.

    More than one paddle.

    Add some jazzy music and sound effects.

    Revamp your graphics.

    Hiscores table.

    PvP mode.

    Online multiplayer.

  • The ball hits the brick, gets reflected properly and after that the brick dissapears

    Ball can get reflected on the sides and top of a brick as well, so make sure you leave space between upper screen border and bricks

  • Look at tutorial objects and make a class Brick and an ArrayList of it

    Fill the ArrayList with a double nested for loop

  • well guys, thank you :D

  • So, what did you do with it?

  • ArrayList<Brick> bricks = new ArrayList(); 
    
    void setup() {
    
      size(1000, 800);
      background(0);
    
      initBricks();
    }//func 
    
    void draw() {
    
      background(0);
    
      for (Brick currentBrick : bricks) { 
        currentBrick.display();
      } // for
    }//func 
    
    // -------------------------------------------------
    // help functions 
    
    void initBricks() {
    
      // size of one brick
      float w = 60; 
      float h = 20; 
    
      // how many bricks do we have Horizontally 
      int numberHorizontally = 10; 
      int numberVertically = 3; 
    
      // how much space is not covered by the bricks Horizontally (in pixels)
      float spaceHorizontally = width - (w*numberHorizontally); 
      // half of which we add on the left so the bricks are centered
      float offsetX= spaceHorizontally/2;
    
      // ...and what we add at the top to have a space from the top of the screen
      float offsetY= 100;
    
      for (int x = 0; x<numberHorizontally; x++) { 
        for (int y= 0; y<numberVertically; y++) {
          // Using "if" to give it a small variation
          if (x!=y) {
            Brick newBrick=new Brick(x*w+offsetX, y*h+offsetY, w, h);
            bricks.add(newBrick);
          }//if
        }
      }
    }//func 
    
    // ==============================================
    
    class Brick {
    
      float x, y; 
      float w, h;
    
      color col=color(random(100, 255), random(100, 255), random(0, 255));
    
      boolean exists=true; 
    
      // constr 
      Brick(float x_, float y_, 
        float w_, float h_) {
    
        x=x_;
        y=y_;
        w=w_;
        h=h_;
      }//constr
    
      void display() {
        fill(col);
        rect(x, y, w, h);
      }//method 
      //
    }//class
    //
    
Sign In or Register to comment.