Thursday, 30 May 2013

Planning

With the help of +Vivian Luu, I chose to do the second option - where a user clicks a button containing all the information of where they are in the array. 

So, on the screen, there are a couple things that should be displayed including: 


  1. Number of Galleons
  2. List of Properties
  3. Where they are on the board
  4. Whether they have a get out of jail free card
  5. The number of times the opponent has landed on the property 
Thaaat's pretty much all I can think of for now. I can always make the changes though. Okay, here goes. 


Also, I compiled a bunch of pictures for the game board (as a home screen); and this is the final version: 


I DID IT! I DID IT! IT LOOKS SO PREEETY NOW :) 



I HASES A SOLUTION!

So I "talked" (technically emailed) Ryk about not using the moving of the pawns.

He said that I can have a bunch of other pictures that has player 1 on the left; another picture with player 2 on the right; and then a picture with both of them on the same pawn.

Another option would be just getting the user to press "Get Information" or something and they can see where they are on the board (they will get notified with a JOptionPane anyways), how much they have in their Gringotts Account, what their pictury thingy is............

Wednesday, 29 May 2013

UH OH (big one)

I asked Ryk about the JLayeredPanes about the movement of monopoly. And he wasn't sure, so he called Justin over. Justin looked through every inch of the code, and couldn't find anything wrong. It still looks like this: 


Tell me, Harry, what exactly is the function of a rubber duck continued.


This is what I have in my program when I create the JLabel. And nowhere, do I say that I am putting it in the centre. 
      
 Object[] possibleValues = { "Dragooon, The Great", "Aslan", "Bilbo", "Luna Lovegood" , "Sherlock Holmes"};
       Object selectedValue = JOptionPane.showInputDialog(frame, "What character would you like to be? ", "Character", JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]);
       
       if (selectedValue.equals("Dragooon, The Great"))
       { 
          characterUser = new JLabel(new ImageIcon("C"+1+".png"));
          if (tracing) System.out.println("Dragoon the Great: " + characterUser);
       } //end of if statement
       
       else if (selectedValue.equals("Aslan"))
       {
           characterUser = new JLabel(new ImageIcon("C"+2+".png"));
           if (tracing) System.out.println("Aslan: " + characterUser);
       } //end of else if statement
       
       else if (selectedValue.equals("Bilbo"))
       { 
           characterUser = new JLabel(new ImageIcon("C"+3+".png"));
           if (tracing) System.out.println("Bilbo: " + characterUser);
       } //end of if statement
       
       else if (selectedValue.equals("Luna Lovegood"))
       {
            characterUser = new JLabel(new ImageIcon("C"+4+".png"));
            if (tracing) System.out.println("Luna Lovegood: " + characterUser);
       } //end of else if statement
       
       else if (selectedValue.equals("Sherlock Holmes"))
       {
            characterUser = new JLabel(new ImageIcon("C"+5+".png"));
            if (tracing) System.out.println("Sherlock Holmes: " + characterUser);
       } //end of if statement

So in the method that I add the picture to the frame (it is also in the last post), this is what pops up instead: 



Tell me, Harry, what exactly is the function of a rubber duck?

Siriusly! I'm getting distracted by that :) 

Anyways, I tried to add the pawns to my board, but it added *IN THE MIDDLE* instead of on the board! I even changed the coordinates from (2, 48) to (100, 100) and it didn't change a thing! I'm even adding it in the NORTH panel and it still shows up in the middle! DARRNIT! Something's gone entirely wrong o-O 

SHEEESH! I set these locations: 1458 , 575 and IT STILL DISPLAYS IN THE MIDDLE! 

I don't want to bother Ryk about it, but this is getting so freaken annoying! 

I even have this as tracing: 


if (tracing) 
        {
            System.out.println("Character in location before adding: " + characterUser.getLocation());
            System.out.println("Character in layer before adding: " +north.getLayer(characterUser));
            System.out.println("Character in index before adding: " +north.getIndexOf(characterUser));
            System.out.println("Character's position before adding: " +characterUser.getLocation());
        } //end of if statement

And this is what outputs (which is also correct!) 


Character in location creating pane: java.awt.Point[x=0,y=0]
Character in location before adding: java.awt.Point[x=1458,y=575]
Character in layer before adding: 3
Character in index before adding: -1
Character's position before adding: java.awt.Point[x=1458,y=575]
Character in location after adding: java.awt.Point[x=1458,y=575]
BUILD SUCCESSFUL (total time: 7 seconds)

Originally, I set the position to (0, 0). And then I set it to 1458, 575; and all the other ones are correct, but it still show up in the middle. 

This is so irritating! It really shouldn't be that freaken hard! UGHHHH! 

I wonder if it has something to do with the coordinates of the JLabel rather than the pane because when i use mouseClicked, it gives the coordinates on the JLabel rather than the pane in general. BUT THAT DOESN'T EXPLAIN WHY THE BLOODY HELL IT IS IN THE MIDDLE! 

EEEEEEEEEEEEEEK! I'm taking a break from CS right now >_< It's not making any sense. And I can't do anything about the program when I'm freaking out about it. So, whatevers! Be back in an hour -_- 

Hello, again.


Hi...

So I'm going back to trying to program the pawns again. I don't really know how to set the location (although I tried to use setBounds..and the icon didn't even show up). 

Eeeeeeeeeeeeeeeeeeeeeeeeeek. Time to look at the Java API's again :) 

 Oiiikay! This is super weird: 

I've set the user's character at position (2, 48) which is the (hopefully is) the coordinate of the startAdventure square. Only program is, that it isn't showing up. It might be because of the JLayeredPane? This is going to be a loooooooong day...

Tuesday, 28 May 2013

Back to the same problem.

Hi. 

I'm back to the same problem again. 

Ryk says that the programming of pawns should be quite easy, but it's so confusing. 

There's white space between north and south properties, and so just increasing it by 117 doesn't work because it will keep moving left, and possibly even into the white space causing the player to not even know where he or she is. 

North Coordinates for User: 



X Coordinate
Y Coordinate
2
48
19
48
141
48
258
48
377
48
498
48
612
48
733
48
849
48
980
48

North Coordinates for Com Pewter: 


X Coordinate
Y Coordinate
2
48
95
48
211
48
330
48
443
48
562
48
686
48
802
48
902
48
1,067.5
48


 East Coordinates for Com Pewter: 


X Coordinate
Y Coordinate
1151.875
35
1151.875
112
1151.875
189
1151.875
261
1151.875
338
1151.875
415
1151.875
493
1151.875
568


 East Coordinates for User: 


X Coordinate
Y Coordinate
983.125
35
983.125
112
983.125
189
983.125
261
983.125
338
983.125
415
983.125
493
983.125
568

 I'm not going to bother out writing out the west and the south, as they are the exact same ones as the ones here, but flipped where I'm going from bottom to top and decreasing the value. 

So I didn't really use math doing this, because it was very difficult to find. And, so I used the mouseClicked method to find out the x-coordinate at which the dice button was being clicked at, so i could substitute that value into the one in North. I estimated the end ones, and I will test them out tomorrow. 

For the east value, I just clicked the button in the middle of the labels, to get the y coordinates and I substituted those into the East values. 
 

...

I tried to use the mouseClicked method (adding the entire pane to the mouseListener); and find the first coordinates. But, it isn't really going well cause the program didn't print out the x-coordinates at which I clicked on. 

And I estimated about where I would put the first pawn, and it didn't work. So I don't really know why - I'll find out later tonight,  I guess. 

I'll try to focus on Intro to Anthro/Social/Psych until probably 5:30 when I get entirely tired of the course, and go back to programming cause it is just so much more rewarding. 

But I really, do, need to find out why the pawn placement isn't showing up. Perhaps the icon wasn't being created or something, although I did create it, but I'll find out soon enough. 

X-Coordinates and Y-Coordinates (AGAIN!)

Asked Ryk again, what would happen for the pawns (because I have to finish it by Friday; and the instructions by Sunday): 

While moving the pawns, it's a similar if statement: 

if (coordinate is too far out of range)
{
Change the coordinate by a certain amount to make it turn.
}

So, it would work using the coordinates that were found previously. 

And it would work using a "getX();" and "getY();" to find out where exactly where to put the icons. I should have 2 set coordinates - one for the user and one for the computer. Probably top and bottom would work on the left side. Though I have to find a way to be able to see the coordinates. 

I just tried it, and the mouseMoved, the mouseDragged, mouseMoved, mouseClicked didn't work. Until later.....>_< 

Monday, 27 May 2013

Also for future reference

Scratch that! I mean 42 :) 

Anyways, I always have to expand my method just to get this information, so I thought I would just paste it here. It is pretty useless to anyone who wants to steal it, so...


 //*******************************************************FIRST SIDE******************************
        
        //Start Square: 
        square[0].owned = true; 
        square[0].mortgaged = false; 
        square[0].buy = 0; 
        square[0].houseHotel = 0; 
        square[0].turn = 0; 
        square[0].payOut = 200; 
        square[0].rent = 0; 
        square[0].houseRent = houses*(square[0].houseHotel); 
        square[0].housePrice = 0; 
        
        //Borgin and Burkes: 
        square [1].owned = false; 
        square [1].mortgaged = false; 
        square [1].buy = 60; 
        square [1].houseHotel = 0; 
        square [1].turn = 0; 
        square [1].payOut = 0; 
        square [1].rent = 20; 
        square [1].houseRent = houses*(square[1].houseHotel); 
        square [1].housePrice = 50; 
        
        //Room of Requirement/Pick up a RoR Card:
        square [2].owned = true; 
        square [2].mortgaged = false; 
        square [2].buy = 0; 
        square [2].houseHotel = 0; 
        square [2].turn = 0; 
        square [2].payOut = 0; 
        square [2].rent = 0; 
        square [2].houseRent = houses*(square[2].houseHotel);       
        square [2].housePrice = 50; 
        
        //Roland Kerr College: 
        square [3].owned = false; 
        square [3].mortgaged = false; 
        square [3].buy = 60; 
        square [3].houseHotel = 0; 
        square [3].turn = 0; 
        square [3].payOut = 0; 
        square [3].rent = 20;
        square [3].houseRent = houses*(square[3].houseHotel);
        square [3].housePrice = 50; 
        
        //Camelot Annual Tax:  
        square [4].owned = true; 
        square [4].mortgaged = false; 
        square [4].buy = 0; 
        square [4].houseHotel = 0; 
        square [4].turn = 0; 
        square [4].payOut = 0; 
        square [4].rent = 200; 
        square [4].houseRent = houses*(square[4].houseHotel); 
        square [4].housePrice = 0; 
        
        //Tardis
        square [5].owned = false; 
        square [5].mortgaged = false; 
        square [5].buy = 200; 
        square [5].houseHotel = 0; 
        square [5].turn = 0; 
        square [5].payOut = 0; 
        square [5].rent = 25; 
        square [5].houseRent = houses*(square[5].houseHotel);        
        square [5].housePrice = 0;       
        
        //Redhaven Property
        square [6].owned = false; 
        square [6].mortgaged = false; 
        square [6].buy = 100; 
        square [6].houseHotel = 0; 
        square [6].turn = 0; 
        square [6].payOut = 0; 
        square [6].rent = 80; 
        square [6].houseRent = houses*(square[6].houseHotel);   
        square [6].housePrice = 50;   
        
        //Room of Requirement/Pick up a RoR Card: 
        square [7].owned = true; 
        square [7].mortgaged = false; 
        square [7].buy = 0; 
        square [7].houseHotel = 0; 
        square [7].turn = 0; 
        square [7].payOut = 0; 
        square [7].rent = 0; 
        square [7].houseRent = houses*(square[7].houseHotel);  
        square [7].housePrice = 0;  
        
        //Piccadilly Circus
        square [8].owned = false; 
        square [8].mortgaged = false; 
        square [8].buy = 100; 
        square [8].houseHotel = 0; 
        square [8].turn = 0; 
        square [8].payOut = 0; 
        square [8].rent = 60; 
        square [8].houseRent = houses*(square[8].houseHotel);        
        square [8].housePrice = 50;         
        
        //**********************************************************************Start of New Side*******************************************
        
        //St Mungo
        square [9].owned = true; 
        square [9].mortgaged = false; 
        square [9].buy = 0; 
        square [9].houseHotel = 0; 
        square [9].turn = 0; 
        square [9].payOut = 0; 
        square [9].rent = 0; 
        square [9].houseRent = houses*(square[9].houseHotel);   
        square [9].housePrice = 0;  
        
        //Platform 9 and 3/4 Quarters. 
        square [10].owned = false; 
        square [10].mortgaged = false; 
        square [10].buy = 120; 
        square [10].houseHotel = 0; 
        square [10].turn = 0; 
        square [10].payOut = 0; 
        square [10].rent = 60; 
        square [10].houseRent = houses*(square[10].houseHotel);  
        square [10].housePrice = 50;         
        
        //Speedy's Cafe in Sherlock 
        square [11].owned = false; 
        square [11].mortgaged = false; 
        square [11].buy = 140; 
        square [11].houseHotel = 0; 
        square [11].turn = 0; 
        square [11].payOut = 0; 
        square [11].rent = 65; 
        square [11].houseRent = houses*(square[11].houseHotel);         
        square [11].housePrice = 75;        
        
        //Lake of Avalon
        square [12].owned = false; 
        square [12].mortgaged = false; 
        square [12].buy = 150; 
        square [12].houseHotel = 0; 
        square [12].turn = 0; 
        square [12].payOut = 0; 
        square [12].rent = (2*(die1+die2)); 
        square [12].houseRent = houses*(square[12].houseHotel);  
        square [12].housePrice = 0;  
        
        //Isengard
        square [13].owned = false; 
        square [13].mortgaged = false; 
        square [13].buy = 140; 
        square [13].houseHotel = 0; 
        square [13].turn = 0; 
        square [13].payOut = 0; 
        square [13].rent = 70; 
        square [13].houseRent = houses*(square[13].houseHotel); 
        square [13].housePrice = 75; 
        
        //Taxi: 
        square [14].owned = false; 
        square [14].mortgaged = false; 
        square [14].buy = 200; 
        square [14].houseHotel = 0; 
        square [14].turn = 0; 
        square [14].payOut = 0; 
        square [14].rent = 25; 
        square [14].houseRent = houses*(square[14].houseHotel);          
        square [14].housePrice = 0;         
        

        //Grimmauld Place:  
        square [15].owned = false; 
        square [15].mortgaged = false; 
        square [15].buy = 160; 
        square [15].houseHotel = 0; 
        square [15].turn = 0; 
        square [15].payOut = 0; 
        square [15].rent = 50; 
        square [15].houseRent = houses*(square[15].houseHotel);          
        square [15].housePrice = 75;        
        
        //Room of Requirement/Pick up a RoR Card: 
        square [16].owned = true; 
        square [16].mortgaged = false; 
        square [16].buy = 0; 
        square [16].houseHotel = 0; 
        square [16].turn = 0; 
        square [16].payOut = 0; 
        square [16].rent = 0; 
        square [16].houseRent = houses*(square[16].houseHotel);          
        square [16].housePrice = 0;        
               
        
        //Quidditch Pitch
        square [17].owned = false; 
        square [17].mortgaged = false; 
        square [17].buy = 180; 
        square [17].houseHotel = 0; 
        square [17].turn = 0; 
        square [17].payOut = 0; 
        square [17].rent = 70; 
        square [17].houseRent = houses*(square[17].houseHotel);          
        square [17].housePrice = 75;    
        
        //**********************************************START OF NEW SIDE****************************************************
        
        //The Tavern (Free Parking) 
        square [18].owned = true; 
        square [18].mortgaged = false; 
        square [18].buy = 0; 
        square [18].houseHotel = 0; 
        square [18].turn = 0; 
        square [18].payOut = pot; 
        square [18].rent = 0; 
        square [18].houseRent = houses*(square[18].houseHotel);          
        square [18].housePrice = 0; 
        
        //Hagrid's Hut
        square [19].owned = false; 
        square [19].mortgaged = false; 
        square [19].buy = 220; 
        square [19].houseHotel = 0; 
        square [19].turn = 0; 
        square [19].payOut = 0; 
        square [19].rent = 75; 
        square [19].houseRent = houses*(square[19].houseHotel);          
        square [19].housePrice = 90; 
        
        //Room of Requirement/Pick up a RoR Card: 
        square [20].owned = true; 
        square [20].mortgaged = false; 
        square [20].buy = 0; 
        square [20].houseHotel = 0; 
        square [20].turn = 0; 
        square [20].payOut = 0; 
        square [20].rent = 0; 
        square [20].houseRent = houses*(square[20].houseHotel);          
        square [20].housePrice = 0;        
        
        //Aslan's Country
        square [21].owned = false; 
        square [21].mortgaged = false; 
        square [21].buy = 220; 
        square [21].houseHotel = 0; 
        square [21].turn = 0; 
        square [21].payOut = 0; 
        square [21].rent = 75; 
        square [21].houseRent = houses*(square[21].houseHotel);          
        square [21].housePrice = 90; 
        
        //Enter Wardrobe
        square [22].owned = false; 
        square [22].mortgaged = false; 
        square [22].buy = 200; 
        square [22].houseHotel = 0; 
        square [22].turn = 0; 
        square [22].payOut = 0; 
        square [22].rent = 25; 
        square [22].houseRent = houses*(square[22].houseHotel);          
        square [22].housePrice = 90;         
        
        //221 Baker Street
        square [23].owned = false; 
        square [23].mortgaged = false; 
        square [23].buy = 240; 
        square [23].houseHotel = 0; 
        square [23].turn = 0; 
        square [23].payOut = 0; 
        square [23].rent = 75; 
        square [23].houseRent = houses*(square[23].houseHotel);          
        square [23].housePrice = 90;  
        
        //Northumberland Street
        square [24].owned = false; 
        square [24].mortgaged = false; 
        square [24].buy = 260; 
        square [24].houseHotel = 0; 
        square [24].turn = 0; 
        square [24].payOut = 0; 
        square [24].rent = 70; 
        square [24].houseRent = houses*(square[24].houseHotel);          
        square [24].housePrice = 90;  
        
        //Beaversdam
        square [25].owned = false; 
        square [25].mortgaged = false; 
        square [25].buy = 150; 
        square [25].houseHotel = 0; 
        square [25].turn = 0; 
        square [25].payOut = 0; 
        square [25].rent = 2*(die1+die2); 
        square [25].houseRent = houses*(square[25].houseHotel);          
        square [25].housePrice = 90;          
                
        //Ministry of Magic
        square [26].owned = false; 
        square [26].mortgaged = false; 
        square [26].buy = 280; 
        square [26].houseHotel = 0; 
        square [26].turn = 0; 
        square [26].payOut = 0; 
        square [26].rent = 75; 
        square [26].houseRent = houses*(square[26].houseHotel);          
        square [26].housePrice = 90;  
        
        //********************************************************LAST LINE***************************************************
        
        //Go to Jail. 
        square [27].owned = true; 
        square [27].mortgaged = false; 
        square [27].buy = 0; 
        square [27].houseHotel = 0; 
        square [27].turn = 0; 
        square [27].payOut = 0; 
        square [27].rent = 0; 
        square [27].houseRent = 0; 
        square [27].housePrice = 0;  
               
        //Mordor
        square [28].owned = false; 
        square [28].mortgaged = false; 
        square [28].buy = 300; 
        square [28].houseHotel = 0; 
        square [28].turn = 0; 
        square [28].payOut = 0; 
        square [28].rent = 80; 
        square [28].houseRent = houses*(square[28].houseHotel);          
        square [28].housePrice = 100;
        
        //Bagshot Row
        square [29].owned = false; 
        square [29].mortgaged = false; 
        square [29].buy = 300; 
        square [29].houseHotel = 0; 
        square [29].turn = 0; 
        square [29].payOut = 0; 
        square [29].rent = 80; 
        square [29].houseRent = houses*(square[29].houseHotel);          
        square [29].housePrice = 100;  
                
        //Room of Requirement
        square [30].owned = true; 
        square [30].mortgaged = false; 
        square [30].buy = 0; 
        square [30].houseHotel = 0; 
        square [30].turn = 0; 
        square [30].payOut = 0; 
        square [30].rent = 0; 
        square [30].houseRent = houses*(square[30].houseHotel);          
        square [30].housePrice = 0;  
        
                
        //Hogwarts Express
        square [31].owned = false; 
        square [31].mortgaged = false; 
        square [31].buy = 200; 
        square [31].houseHotel = 0; 
        square [31].turn = 0; 
        square [31].payOut = 0; 
        square [31].rent = 25; 
        square [31].houseRent = houses*(square[31].houseHotel);          
        square [31].housePrice = 0;        
        
        //Ealdor
        square [32].owned = false; 
        square [32].mortgaged = false; 
        square [32].buy = 320; 
        square [32].houseHotel = 0; 
        square [32].turn = 0; 
        square [32].payOut = 0; 
        square [32].rent = 85; 
        square [32].houseRent = houses*(square[32].houseHotel);          
        square [32].housePrice = 100;  

        
        //Room of Requirement
        square [33].owned = true; 
        square [33].mortgaged = false; 
        square [33].buy = 0; 
        square [33].houseHotel = 0; 
        square [33].turn = 0; 
        square [33].payOut = 0; 
        square [33].rent = 0; 
        square [33].houseRent = houses*(square[33].houseHotel);          
        square [33].housePrice = 0;
        
        //Camelot's Citadel
        square [34].owned = false; 
        square [34].mortgaged = false; 
        square [34].buy = 350; 
        square [34].houseHotel = 0; 
        square [34].turn = 0; 
        square [34].payOut = 0; 
        square [34].rent = 100; 
        square [34].houseRent = houses*(square[34].houseHotel);          
        square [34].housePrice = 200;        
        
        //Hogwarts
        square [35].owned = false; 
        square [35].mortgaged = false; 
        square [35].buy = 400; 
        square [35].houseHotel = 0; 
        square [35].turn = 0; 
        square [35].payOut = 0; 
        square [35].rent = 100; 
        square [35].houseRent = houses*(square[35].houseHotel);          
        square [35].housePrice = 200;