Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,874
    Rep Power
    25

    Default Re: Don't know how to add a scorekeeper for my game?

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    What values are changing when the blue button moves?
    Last edited by Norm; 04-04-2014 at 03:16 AM.
    If you don't understand my response, don't ignore it, ask a question.

  2. #22
    OldSkoolBray is offline Member
    Join Date
    Apr 2014
    Posts
    17
    Rep Power
    0

    Default Re: Don't know how to add a scorekeeper for my game?

    Hello I have changed the layout of my game so that the functionality works. what i want to do now is have a button flash up when the puck and the goal collide. I have created a rectangle and now i want to create an if statement that basically says if these two colide, output Red Wins. do you no what i mean? i will show u the part of the code i am trying to manipulate ..

    This shows the creation of my rectangle in my logic class

    // Collisions between goals and puck
    static boolean GoalPuckCollision (JButton object1, JButton object3)
    {
    Rectangle three = new Rectangle (object1.getX(), object1.getY(),
    object1.getWidth(), object1.getHeight());

    Rectangle four = new Rectangle (object3.getX(), object3.getY(),
    object3.getWidth(), object3.getHeight());
    return three.intersects(four);
    }

    In my main class i have put ....

    // Allow Goal to be scored in blue goal
    if (LogicClass.GoalPuckCollision(btnPuck, btnBlueGoal) == true)
    {

    }

    I don't know what to put in-between the brackets to allow a piece of text to appear on my screen saying red Wins.

  3. #23
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,225
    Rep Power
    20

    Default Re: Don't know how to add a scorekeeper for my game?

    Norm has requested you post your code inside code tags several times now.
    Is there a problem?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 2
    Last Post: 03-03-2014, 07:48 PM
  2. Replies: 4
    Last Post: 07-08-2012, 10:07 AM
  3. Replies: 1
    Last Post: 06-02-2011, 10:29 AM
  4. Replies: 2
    Last Post: 08-05-2010, 05:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •