mastrgamr's Profile
Reputation: 2
Apprentice
- Group:
- Members
- Active Posts:
- 18 (0.02 per day)
- Joined:
- 30-December 10
- Profile Views:
- 352
- Last Active:
Sep 27 2012 12:51 PM- Currently:
- Offline
Previous Fields
- Country:
- US
- OS Preference:
- Windows
- Favorite Browser:
- Chrome
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- XBox
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Latest Visitors
-
macosxnerd101 
16 Oct 2011 - 19:18 -
BlahBlahMan 
16 Oct 2011 - 18:42
Posts I've Made
-
In Topic: how to go about making a tetris clone?
Posted 24 Jan 2012
stayscrisp, on 24 January 2012 - 05:12 PM, said:Why the oversized arrays as well? Tetris blocks are at most 4x4 yet you are using 5x5, reason?
Yes i took a look at it and noticed it myself, only reason I did 5x5 is because of the way i set the rotation for the straight tetris block. I was thinking of changing it. -
In Topic: how to go about making a tetris clone?
Posted 22 Jan 2012
That's what I'm trying to tackle now, so far I have a multidim array for the blocks in tetris:
private static final int[/*blockType*/][/*rotation*/][][] piece = { { //blockType = square = 0 { //rotation {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 0, 0} } }, { //Straight = 2 { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 1, 1, 1}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 1, 0, 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 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 1, 1, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 0} } }, { //S = 6 { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 1, 0}, {0, 1, 1, 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 1, 0}, {0, 1, 1, 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} } }, { //Z = 7 { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 1, 0, 0}, {0, 0, 1, 1, 0}, {0, 0, 0, 0, 0} }, { {0, 0, 0, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 1, 1, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 0, 0} } } };
basically when i run the game and load a block i access this array and say for each "1" in the array, draw a square, that acts as 1 of the 4 segments of the tetris block. The same idea will go behind the collision detections, create a rectangle for each segment. -
In Topic: reading from text file with Scanner
Posted 15 Jan 2012
mastrgamr, on 15 January 2012 - 03:02 AM, said:
GregBrannon, on 15 January 2012 - 02:57 AM, said:How many lines are in the file when you created the input object? Did you get the same results when you ran your program a second or third time?
There is two lines in the file, the ones You see int he program above. When I rerun the program again same results.
Well i feel stupid
, the program works if i close the outputstream then continue onto scanning from the file. Maybe it's just a textbook typo.
I guess since the outputstream leaves the scanner at a null line in the text file the input Scanner doesn't read any other info... i think. -
In Topic: reading from text file with Scanner
Posted 15 Jan 2012
GregBrannon, on 15 January 2012 - 02:57 AM, said:How many lines are in the file when you created the input object? Did you get the same results when you ran your program a second or third time?
There is two lines in the file, the ones You see int he program above. When I rerun the program again same results. -
In Topic: merging two 1D arrays into one 2D array
Posted 6 Jan 2012
sepp2k, on 06 January 2012 - 09:19 AM, said:The reason that it isn't shuffling is that primitive types can't be generic-arguments in Java and that asList is defined using variadic arguments. Together these two facts mean that if you pass an int[] as an argument to asList, it will return a List<int[]> with a single element. Shuffling that won't accomplish anything of course.
Thanks for clearing that up
I have the answer I need now, thanks to everyone that helped.
My Information
- Member Title:
- New D.I.C Head
- Age:
- 22 years old
- Birthday:
- April 26, 1991
- Gender:
-
- Location:
- New York, New York
- Full Name:
- Stuart Smith
- Years Programming:
- 3
- Programming Languages:
- Java, C# (XNA), C++
Contact Information
- E-mail:
- Private
- MSN:
-
mastrgamr@live.com
- Website URL:
-
http://mastrgamr.net
- Twitter:
- mastrgamr
- Xfire:
- mastrgamr92
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
mastrgamr has no profile comments yet. Why not say hello?