Bryce Heath

Greenhorn
+ Follow
since Sep 16, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bryce Heath

Hi again guys
I have been hard at work reading about tile map based games. I have managed to make a program that runs a movable sprite, around a tilemap created from a text file. This map is also set with collision detection on all tiles and the players sprite. My new project is to make this program have an RPG overhead view with X/Y scrolling as the player moves around. After many days of reading, I have found this is done by making a "camera" class that is used as a location reference for what tiles need to be drawn on screen. Now my problem is that I have not found a tutorial that has been able to explain this is a way I understand. I now this is a lot to ask on a forum, but if anyone has the time, I could really use a dumbed down version of this, or even if it is possible with my current code.
Hope someone can help Thanks.
//The Tile maker class that reads the text file map and eventually places the Chars in an array list.


//This is the game class


//This is the hero sprite class


//this is the class of one of the tiles


Sorry for all the code, Im not sure what people might want to see to be able to help me. If any one has any ideas ect please let me know
12 years ago
Hey Thanks for the reply. I'm glad you took the time to look at this. Funny how such a simple mistake can take so long to figure out.
12 years ago
Hey guys
I have been trying to figure out why this line of code never looks at the else if part of the if statement. I have been trying a long time now and no luck maybe someone can figure it out. This is not the exact code I edited it so it would make sense out of context, but as far as I can tell y is ++ but the else if is never run in the loop but all the rest of it is running correctly. Any help would be great.
12 years ago
Hey guys

I'm looking for a good tutorial on how to make a simple tile based map in java. I have been searching google for 2 days now trying to find something that I can work with and still am coming up short. What I have now is a text file map.txt with 1s and 0s, 1s being a gray tile that is passable by the user sprite and 2 being a brown tile that is not. I made 2 png files for the tiles that are 80x80 px each. example of text follows
000000000000
011111111110
011111111110
011111111110
000000000000
I understand that I need a 2d array that will hold the values of the map.text and can figure out the text file reader and delimiters ect, but I do not understand the paint part of the array at what point am I pointing the array values to the png images and after that how would I take the 0 0 index in the array that being a brown tile and paint it having to use an X/Y pos due to the fact that the x/y pos x = 0 / y=0 is a single pixel in the top left corner yet the image it self is 80x80px would I have to skip +80 X to the right then repaint and move down at the end of the row? I hope this all makes sense thanks
12 years ago
Hi guys
I'm working on making a very simple game to practice what I have learned so far programming. So far what I have done is made an enemy class, a hero class, a class I called gameplay that I figured would contain methods for fights ect, and the main. So I think my classes for hero/enemy are fine, and went on to make a very basic fight method using loops, and have relized in order to do this I beleive I will have to create the hero and the enemy object in this method (please correct me if im wrong) the problem with that is how can the main method access these objects? I dont think i want to create new ones in the main because they would not produce the right life ect from a battle that happened. Hope this made sense ill post some code be kind lol.

GamePlay class


Orc class



Hero class

12 years ago
Hi guys
Heres my new problem for the night, im going to post the driver code so you can see what im trying to do. See first comment for the problem. Thank you.

12 years ago
Omg Now I feel really dumb, moments after posting this I figured it out. The .nextLine was not printing the string because the string was never skipped (not sure how a string could be skipped?) but by using just next it works fine. Sorry for the trouble, glad I got it figured out.
12 years ago
Hey guys
I wanted to check this before I start researching into something thats not my problem
in the code

It seems if I use a string with anything else IE double int the string in the variable name does not print. If I both scans as ints or 1 int 1 double ect it prints fine. If I understood an earlier post it is a problem with the scan.nextLine I am using. I did look at some links provided for me but could not make heads or tails of it, and would like to know what specifically the code is doing when it does the scan.nextLine or even better if any 1 has a link to a good Scanner tutorial so I may understand a little better. Sorry Campbell if it seems im not putting in an effort on this problem but I have been googleing for hrs now and am a little frustrated, I hope this is not viewed badly.
Thank you again everyone for your continued patience with me, I know it can be annoying when people dont understand something.
12 years ago
Yeah lol ill cross that path when it comes, ive gone back to step 1 to work out all the bugs before I move on. The problem I am currently having is the Scanner is not working in my first case if I remove it from the case it works fine, just doesent take input while its inside the case. Any idea why?

prints
Please enter account name
Welcome:
end program

If removed from the switch
works fine IE
Please enter account name
Welcome: "account name"
end program
12 years ago
Ok cool man, thanks for the links in the book it tends to go over things in one paragraph, never really explaining how they work fully. Ill take a look at the links hopefully it will help because when I run this the first switch and scan work fine but when it gets into case 1 both system prints run but the program terminates without letting the user type.
12 years ago
Hi again
Thanks for the reply man, ok cool what you said makes sense. Really I just started throwing this together yesterday to see if I know how to use what I have read so far, so ty for sticking with my silly problems lol. Anyway ill start from the top, good to know on the scanner class I thought I might have to put the input into a variable but was not sure. In the case of the users name

the user enters a string and creates the name object, then puts the string entered into the owner variable that is part of the worker class making both owner and acctName the user entered string. Is that right? Im going to take your advice and go back and try to start from the top but if you get time please post back. I think I dont understand the relationship between the driver and the worker correctly.
12 years ago
Hey guys
Im writing a banking program to practice a little of what I have learned so far. I think I am having a problem with the class I made "Account" the problem it most likely that I dont understand classes right lol. The specific problem I seem to have is in the driver, in my Switch statement. What I am looking to do is have the program ask for the user to input there name, then an initial deposit into the bank account. Then I want the worker class to create an account object "acct1" then print out the initial deposit and balance. Im not really sure where I messed up, sorry I know a very broad question, hope some one sees what im doing wrong .

Driver


Worker

12 years ago
Hey guys thanks for the reply.
I guess my problem was that I dident understand nested for's right. I thought it would run the outer for, enter inner for, run inner for once and drop back out to the outer for to recheck again if the outer was still true then back into the inner. Want to make sure I am understanding it correctly when thinking that it will run the outer for go to inner for and keep running inner for till it is not longer true, then drop back to the outer for?
12 years ago
Hey thanks for the quick reply, I tried that also with no luck. Im not really sure whats up with it because with MIN_ROW being 0 if I did for (int row = 2; row > MIN_ROW; row--) wouldent that set row to 2 run the loop decrease row to 1 run the loop a second time decrease row to 0 making the row> MIN_ROW end the loop because the 0 of row is now not greater but = to MIN_ROW? Hope that makes sense look forward to more posts on the subject.
12 years ago
Hey guys
Working on my for loops and trying to make a diamond shape with this program, but for some reason my second for is making 3 stars when it should only do 2. Ill keep working on it but any ideas would be great.

12 years ago