Added: 2 years ago
From: successfulbuild
Views: 1,589
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (7)

Sign In or Sign Up now to post a comment!
  • y = this.getHeight() - 50;

    g.setColor(Color.BLUE);

    

  • for(x = 0; x < this.getWidth(); x++)

    {

    g.setColor(Color.BLUE)

    g.fillRect(x,y,1,1);

    g.setColor(Color.BLACK);

    g.fillRect(x, y+1, 1, this.getHeight());

    y += rand.nextInt(5) - 2

    }

  • hi, i'm trying to code the horizon using the random object. but i can't get it to work. it only gives me a bunch of scattered lines within a certain range.

  • @bingin15 post the variable initializations and then the for loop, at the end of the code, and let me know if it works.

  • @successfulbuild hi, i should have posted this a while ago, but i received the answer i needed from someone in my class. i needed to just add whatever the random number was to the y value each time.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more