Arkanoid_game

So, i have this arkanoid game which is ready, but i need to do some extra things that i cannot do and i would like you to help me.

I have to:

-Set up a scoring system - When the ball is out of the screen, end the game - The slider must to get smaller, in relation to time ( permanent deformation)

You could save me if you could help me

Thank you

Answers

  • edited October 2015

    Always when being confronted with a new task you need to ask yourself, what is the context, what is the exact meaning of the task, what are the single steps to reach the goal. Break the problem down into single steps.

    Set up a scoring system

    you need a variable int score = 0;

    when the ball hits a brick say score++;

    display the score in the corner with text()

    When the ball is out of the screen, end the game

    you need a state system to be able to display a game over screen when the ball is out of the screen. So let's say your state is a variable of type int. And it can be 0 for GAME or 1 for GAMEOVER.

    So when the ball leaves the screen say state = 1;

    in draw()

    have

    void draw() {
    
        switch(state) {
    
            case 0: 
            // what you have in draw now
            break;
    
            case 1: 
            background(0);
            text(game over, 200,220);
            break;
    
          } // switch
    
    } // draw
    

    (alternatively

    • when the ball leaves the screen say lives--; (and reset ball have a short screen displayed)
    • when (lives == 0) set game over;
    • initially lives=3;

    )

    The slider must get smaller, in relation to time ( permanent deformation):

    widthSlider = widthSlider - 0.0001; 
    if (widthSlider<5) 
       widthSlider = 5; 
    
Sign In or Register to comment.