Ryk found out what the error was. The JOptionPane was showing up on the screen, but somewhere off the screen. So he said to specify the panel instead of the null inside the declaration of the JOptionPane.
AND IT WORKED!
It's always one word -__-
Welcome! Fandoms in the monopoly include Doctor Who, Sherlock, Merlin, Harry Potter, Lord of the Rings and Narnia. You'll see milestones while coding, errors that I have encountered, an "environmental message" , "computer science and careers" that might relate to this program, and how emerging areas of computer science might benefit from this program. Other things include errors that were encountered, the brainstorming before coding. Ryk, happy reading!
Friday, 24 May 2013
Thursday, 23 May 2013
Buying Properties
I haven't sorted out the buying properties part either. I'm working that along with the pawns.
Although I'm doing the purchasing of properties first. So, basically if any of the buttons are pressed saying "Buy Property"; for example, the price of the property will be taken off of the user's account. On top of it, the property that they have purchased will change to "true" for owned and so the computer cannot buy that property, too. They may land on it accidentally and be forced to pay rent.
And I've run into a weird error. Cause in the mouseListener, I am testing it to see if the user presses it. So, if it is pressed, a certain thing will happen. An example of this:
For the "I'm going on an adventure!" square, the user is supposed to gain 200 galleons. It seems not-really-user-friendly to just take it off their gringotts account without telling them, so I created a JOptionPanel to let them know so that they could just press okay or something. But it isn't working. The JOptionPane is making the program well, just die, really. It prints out what is in the if statement into the console window. And that's perfectly good, but the user kind of needs to know how much money they have!
Oh. I see. Unless I put a JLabel in the centre showing the amount of money he or she has. But it looks much better in the JOptionPane so I'm going to try to get that working first.
Although I'm doing the purchasing of properties first. So, basically if any of the buttons are pressed saying "Buy Property"; for example, the price of the property will be taken off of the user's account. On top of it, the property that they have purchased will change to "true" for owned and so the computer cannot buy that property, too. They may land on it accidentally and be forced to pay rent.
And I've run into a weird error. Cause in the mouseListener, I am testing it to see if the user presses it. So, if it is pressed, a certain thing will happen. An example of this:
For the "I'm going on an adventure!" square, the user is supposed to gain 200 galleons. It seems not-really-user-friendly to just take it off their gringotts account without telling them, so I created a JOptionPanel to let them know so that they could just press okay or something. But it isn't working. The JOptionPane is making the program well, just die, really. It prints out what is in the if statement into the console window. And that's perfectly good, but the user kind of needs to know how much money they have!
Oh. I see. Unless I put a JLabel in the centre showing the amount of money he or she has. But it looks much better in the JOptionPane so I'm going to try to get that working first.
Placement of Pawns: South and West
ONTO THE SOUTH PART OF THE PROGRAM!
Tavern: (1061, 580)
Hagrid's Hut: (947, 580)
Room of Requirement: (883, 580)
Aslan's Country: (719, 580)
Wardrobe: (605, 580)
221 B Baker Street: (491, 580)
Northumberland Street: (378, 580)
Beaversdam: (263, 580)
Ministry of Magic: (149, 580)
Go to St. Mungos': (30, 580)
ONTO THE WEST PART OF THE PROGRAM!
Mordor: (30, 580)
Bagshot Row: (30, 500)
Room of Requirement: (30, 420)
Hogwarts Express: (30, 340)
The Ealdor: (30, 260)
Room of Requirement: (30, 180)
The Citadel: (30, 100)
Hogwarts: (30, 20)
Tavern: (1061, 580)
Hagrid's Hut: (947, 580)
Room of Requirement: (883, 580)
Aslan's Country: (719, 580)
Wardrobe: (605, 580)
221 B Baker Street: (491, 580)
Northumberland Street: (378, 580)
Beaversdam: (263, 580)
Ministry of Magic: (149, 580)
Go to St. Mungos': (30, 580)
ONTO THE WEST PART OF THE PROGRAM!
Mordor: (30, 580)
Bagshot Row: (30, 500)
Room of Requirement: (30, 420)
Hogwarts Express: (30, 340)
The Ealdor: (30, 260)
Room of Requirement: (30, 180)
The Citadel: (30, 100)
Hogwarts: (30, 20)
Wednesday, 22 May 2013
Placement of Pawns: North and South
HEEERE GOES!
For the north boundary, the screen size is 1200. There are 10 JLabels on the top row. The size is 114 by 80. But I think I'm going to add about 5 pixels of extra room just in case because there is quite a bit of white space.
Therefore, for the north boundary, the x-value would start at (40) and would start at y-value (30) <-- give or take a few.
Start Adventure --> (30, 40)
Borgin and Burkes --> (149, 40)
Room of Requirement --> (263, 40)
Roland Kerr College --> (378, 40)
Camelot's Annual Tax --> (491, 40)
Tardis --> (605, 40)
Redhaven --> (719, 40)
Room of Requirement --> (833, 40)
Piccadilly Circus --> (947, 40)
St. Mungos' Hospital --> (1061, 40)
For the east boundary, the length of the screen size is 1200 but there is a lot less room.
Platform 9 and 3/4: (30, 20)
Speedy's Cafe: (30, 100)
Avalon: (30, 180)
Isengard: (30, 260)
Taxi: (30, 340)
Grimmauld Place: (30, 420)
Room of Requirement: (30, 500)
Quidditch Pitch: (30, 580)
For the north boundary, the screen size is 1200. There are 10 JLabels on the top row. The size is 114 by 80. But I think I'm going to add about 5 pixels of extra room just in case because there is quite a bit of white space.
Therefore, for the north boundary, the x-value would start at (40) and would start at y-value (30) <-- give or take a few.
Start Adventure --> (30, 40)
Borgin and Burkes --> (149, 40)
Room of Requirement --> (263, 40)
Roland Kerr College --> (378, 40)
Camelot's Annual Tax --> (491, 40)
Tardis --> (605, 40)
Redhaven --> (719, 40)
Room of Requirement --> (833, 40)
Piccadilly Circus --> (947, 40)
St. Mungos' Hospital --> (1061, 40)
For the east boundary, the length of the screen size is 1200 but there is a lot less room.
Platform 9 and 3/4: (30, 20)
Speedy's Cafe: (30, 100)
Avalon: (30, 180)
Isengard: (30, 260)
Taxi: (30, 340)
Grimmauld Place: (30, 420)
Room of Requirement: (30, 500)
Quidditch Pitch: (30, 580)
Tuesday, 21 May 2013
X and Y Coordinates
Well, I haven't even had a chance to do X and Y coordinates - I'll do this when I get home. Cause I'm busy fixing Selva's program. I've chosen my five pawns here:
So to do some initial while Selva is asking someone in our class something about our program, here are some initial calculations.
My frame size is 1200 by 1200. On the North boundary, though, there are 10 properties. This means that the width must be found of each property (or at least the average cause they vary by a small amount from 1-2 pixels). It's not that big of a deal, but here goes.
The average size of all the game board things are 114 * 80. This means that the height is 80; and the width is 114. Therefore, for the north boundary, it will end up in the middle on the left side of properties. I just hope it's mostly visible. So the x-coordinate would be 40 on that side, and it would not change for the North Boundary.
For the east boundary, the y-value will remain the exact same - so the width would be 114*10 = 1140; meaning that's the end of the boundary. I can then calculate how much the difference would be so I can put it down the left sides. This will increase while going down the y-axis. Oh, and I haven't done any of this programming yet. Selva's just drawing out the game board to determine how to structure the for loop, so I'm sort of ranting on here about the program. It's really great for brainstorming what to do.
Oh, and for south boundary, the x-value would remain the same just as it was with the north boundary because there are 10 properties on each end. The width of each property must be found and subtracted from the initial position. It must be subtracted because while moving towards the origin, unlike a normal graph in mathematics, the graph goes the opposite direction. The top left corner is the origin, having the coordinates of (0, 0); while moving to the right (but staying on the x-axis), the value increases just as it does in quadrant 4. However while moving from point (0, 0) and moving downwards, the y-value will increase. This means that the graph has therefore been flipped and anything below the x-axis is positive. It is pretty counterintuitive, which is why the positioning of this was so difficult to think about, but when you think about it in context, it really isn't that much.
And as said before, in the west boundary, the y-value will remain the same and the height of each square (or at least the average - most likely going to be 80); will be subtracted from the initial position.
>____<
Fiesicks is throwing me down the drain. Half of me is saying it's fun and I should take it next year; the other half is saying you're killing yourself o_o
I should have been done moving the pawns by today, or at least finding the coordinates. Looks like ICS is going to be preeeety busy today o.O
Anyways, for ICS, I'll probably just end up finding the coordinates of the individual square pieces, and I can find them out on Mac as well. That can then divided by wherever I want to put the pawns on the board, and then add the width of one square each time. But I feel like they should be big enough to see from the small tiny board, so I think I might make them a blackshadow or something of Hermione's face, but that's something to talk about later.
Ryk said that while starting from the top, it will keep adding the width to the x-value. While going down, it will keep adding the height to the y-value. But while doing from right to left on the bottom, it's going to be decreasing the x-value. And finally, for the last side of the board - bottom to top on the west side of the border panel, it will be decreasing the y-value by the height - not the width. I think the best way to do this is in a for loop, but I have to hurry up.
Also, I am going to limit this game to 2 users - one player and the Computer. So every time they click on "buy property," which is in a JLabel, the program will take a certain amount off of their bank card (more like their Gringotts account).
Anyways, physics test tomorrow - after that's done, I can finally squeeze computer science in. If I end up finishing the movement of pawns today, then I'll start on using the mouseListener and taking off a certain amount (which is in an objects array) out of the person's gringotts account.
Also, for Room of Requirement, that's another thing that I have to program. I have it all down, and I know all my cards, which I have already posted here for everyone to see, but shh! So...yeah, tons to do, and I'm going to finish the plotting by today; the if statements by Thursday and the room of requirement by Friday.
As much as I love programming, I can't wait until school's over. I'll be able to refine this program a lot more in the summer if I'm not too busy reviewing Advanced Functions, Calculus and Vectors, Data Management, Grade 12 Computer Science, Physics, or Earth and Space Science. Anywhoozing, it would be a lot more fun to refine this program so I can accommodate up to 8 players and make it like the real version. But for now, time is of the essence and I have to finish it and make sure that there are no bugs...fast! I'm almost thinking that I shouldn't give them houses and hotel options, but that sort of breaks the whole point of monopoly, but I'll see how far I get up to...I really do hope I have time for it because Monopoly isn't Monopoly without houses and hotels. I'll have to run it by Ryk to see if he's okay with it before I make up my mind. Not that it's made up..any time yet. I'll find out by Saturday..
I should have been done moving the pawns by today, or at least finding the coordinates. Looks like ICS is going to be preeeety busy today o.O
Anyways, for ICS, I'll probably just end up finding the coordinates of the individual square pieces, and I can find them out on Mac as well. That can then divided by wherever I want to put the pawns on the board, and then add the width of one square each time. But I feel like they should be big enough to see from the small tiny board, so I think I might make them a blackshadow or something of Hermione's face, but that's something to talk about later.
Ryk said that while starting from the top, it will keep adding the width to the x-value. While going down, it will keep adding the height to the y-value. But while doing from right to left on the bottom, it's going to be decreasing the x-value. And finally, for the last side of the board - bottom to top on the west side of the border panel, it will be decreasing the y-value by the height - not the width. I think the best way to do this is in a for loop, but I have to hurry up.
Also, I am going to limit this game to 2 users - one player and the Computer. So every time they click on "buy property," which is in a JLabel, the program will take a certain amount off of their bank card (more like their Gringotts account).
Anyways, physics test tomorrow - after that's done, I can finally squeeze computer science in. If I end up finishing the movement of pawns today, then I'll start on using the mouseListener and taking off a certain amount (which is in an objects array) out of the person's gringotts account.
Also, for Room of Requirement, that's another thing that I have to program. I have it all down, and I know all my cards, which I have already posted here for everyone to see, but shh! So...yeah, tons to do, and I'm going to finish the plotting by today; the if statements by Thursday and the room of requirement by Friday.
As much as I love programming, I can't wait until school's over. I'll be able to refine this program a lot more in the summer if I'm not too busy reviewing Advanced Functions, Calculus and Vectors, Data Management, Grade 12 Computer Science, Physics, or Earth and Space Science. Anywhoozing, it would be a lot more fun to refine this program so I can accommodate up to 8 players and make it like the real version. But for now, time is of the essence and I have to finish it and make sure that there are no bugs...fast! I'm almost thinking that I shouldn't give them houses and hotel options, but that sort of breaks the whole point of monopoly, but I'll see how far I get up to...I really do hope I have time for it because Monopoly isn't Monopoly without houses and hotels. I'll have to run it by Ryk to see if he's okay with it before I make up my mind. Not that it's made up..any time yet. I'll find out by Saturday..
Saturday, 18 May 2013
Movement of Pawns
For the movement of pawns, that's a bit more difficult because I have to add the graphics object to a JLayeredPane where it will individually add the pawn onto each sort of, part of the gameboard. Anywhoo, thought I'd get that down here in writing, anyways.
I'm sort of falling behind schedule cause I still have to find out how to keep track of the number of people who are playing - I think I might just limit it to Computer and 1 Player for now, might extend it later, but time is of the essence right now.
Also, I still have to test for input on each of the buttons that are pressed because otherwise, the people can't buy properties.
I've been thinking about it, and I think I'll make it an array of objects (yes, another one) that contains a long variable for the amount in your account, and an int variable for the number of houses or hotels that you have on a specific property.
But I might not even have time for all those parts of the program..so, I really don't know....
BLOODY EXAMS! IF NOT FOR EXAMS, I MIGHT HAVE MORE TIME TO MAKE THE PROGRAM FUNNER.
I'm sort of falling behind schedule cause I still have to find out how to keep track of the number of people who are playing - I think I might just limit it to Computer and 1 Player for now, might extend it later, but time is of the essence right now.
Also, I still have to test for input on each of the buttons that are pressed because otherwise, the people can't buy properties.
I've been thinking about it, and I think I'll make it an array of objects (yes, another one) that contains a long variable for the amount in your account, and an int variable for the number of houses or hotels that you have on a specific property.
But I might not even have time for all those parts of the program..so, I really don't know....
BLOODY EXAMS! IF NOT FOR EXAMS, I MIGHT HAVE MORE TIME TO MAKE THE PROGRAM FUNNER.
Thursday, 16 May 2013
Room of Requirement
So I've been thinking about the "chance" and "community chest" cards which will all be determined by random number generators (using Math.Random):
- Start your adventure again. You may collect 200 galleons
- The Goblins perform an error while processing your account as they withdrew 100 galleons from yours instead of Voldemort's. To compensate, Gringotts pays you 50 galleons
- Your father falls ill, and you must visit the Court Physician, Gaius. Under normal circumstances, he wouldn't charge you, but this time, he asks for gold. You must provide him with 50 galleons otherwise he'll tell the King that you are a sorceress/sorcerer. Do you give him 50 galleons or risk him exposing your secret?
- Your friends are annoying you, and with a very random thought, you try to erase their memory. Your wand backfires and you have no recollection of who you are, what you're doing, or how you got to where you were. Go to St. Mungos, now.
- Get out of St. Mungo's Free Card.
- Happy happy birthday! Collect 20 galleons from each player and enjoy!
- You and all your friends decide to spend money on the Chinese Theatre. Yes, that same one that John and his date (plus Sherlock). However, Sherlock only has 3 free tickets, no more, no less. All other players must pay 50 galleons. You, the person who picked up this card must chip in 10 galleons.
- When Uther married a troll whom was so greedy for money, he charged too much from your Gringotts account. He compensates you for a 40 galleons refund.
- Morgana has declared war on Camelot. She is using you to get through to King Arthur. You, can use magic and stop her (but then everyone else will know that you have magic); or you can let her do her worst. What do you do?
- If you choose to use magic and stop her, you receive 40 galleons per house and 115 galleons per hotel.
- If you choose to let her do her worst, you must pay 40 galleons per house and 115 galleons per hotel because Morgana has increased taxes on your land.
- Advance to Ministry of Magic
- Advance to the nearest transportation spot (Taxi, Tardis, Wardrobe or Hogwarts Express). If it is unowned, you can buy this from the bank. If it is owned, roll the dice a second time and pay the owner 10 times the sum of the die.
- Advance to Bagshot Row. If you pass go, collect $200.
- Go backwards seven spaces.
- Advance to Hogwarts. If it is unowned, you may buy this from the bank. If it is owned, pay the owner double the rent.
Of course there are some monopoly things that aren't in the classic version, but it sounds super fun ;D
Wednesday, 15 May 2013
For Future Reference
I just realized that for the sake of the board, the index numbers would be:
0 - Start Adventure
1 - Borgin and Burkes
2 - Room of Requirement
3 - Roland Kerr College
4 - Camelot's Annual Tax
5 - Tardis
6 - Redhaven
7 - Room of Requirement
8 - Piccadilly Circus
9 - St. Mungos
10 - Platform 9.75
11 - Speedy's Cafe
12 - Avalon
13 - Isengard
14 - Taxi
15 - Grimmauld Place
16 - Room of Requirement
17 - Quidditch Pitch
18 - Tavern
19 - Hagrid's Hut
20 - Room of Requirement
21 - Aslan's Country
22 - Wardrobe
23 - 221B Baker Street
24 - Northumberland Street
25 - Beaversdam
26 - Ministry of Magic
27 - Go to St. Mungos
28 - Mordor
29 - Bagshot Row
30 - Room of Requirement
31 - Hogwarts Express
32 - Ealdor
33 - Room of Requirement
34 - Citadel
35 - Hogwarts
0 - Start Adventure
1 - Borgin and Burkes
2 - Room of Requirement
3 - Roland Kerr College
4 - Camelot's Annual Tax
5 - Tardis
6 - Redhaven
7 - Room of Requirement
8 - Piccadilly Circus
9 - St. Mungos
10 - Platform 9.75
11 - Speedy's Cafe
12 - Avalon
13 - Isengard
14 - Taxi
15 - Grimmauld Place
16 - Room of Requirement
17 - Quidditch Pitch
18 - Tavern
19 - Hagrid's Hut
20 - Room of Requirement
21 - Aslan's Country
22 - Wardrobe
23 - 221B Baker Street
24 - Northumberland Street
25 - Beaversdam
26 - Ministry of Magic
27 - Go to St. Mungos
28 - Mordor
29 - Bagshot Row
30 - Room of Requirement
31 - Hogwarts Express
32 - Ealdor
33 - Room of Requirement
34 - Citadel
35 - Hogwarts
OOPS!
I was trying to add the frames onto the screen again this morning, and I realized half way in that when I clicked on the rightmost property, it wouldn't work again!!
Until I realized I have to add the JLabels and the frames backwards, as well...
I'm smart aren't I -__-
So I had to go back and redo all the loops and redo all the names of the things.
JLayered Panes are just great >_< THEY ARE ALL BLOODY BACKWARDS! :o
GAAAAAA. It looks pretty okay now, though, I hope.
Until I realized I have to add the JLabels and the frames backwards, as well...
I'm smart aren't I -__-
So I had to go back and redo all the loops and redo all the names of the things.
JLayered Panes are just great >_< THEY ARE ALL BLOODY BACKWARDS! :o
GAAAAAA. It looks pretty okay now, though, I hope.
Subscribe to:
Posts (Atom)






