Computer Science Canada Java Game Help |
Author: | Luca3490 [ Wed Jul 03, 2013 3:23 pm ] |
Post subject: | Java Game Help |
kso, been working on a Java game for a bit now, and I want to make it so the person controlling the character doesn't see the whole map so when the player moves up a tile, he can see the pre-rendered tile that he could not see before. I have a total of 6 classes: - The main class (holds the dimension's and all of the boring stuff) - The GameFrame class (holds all of the FPS, Screen to look at the rendered tiles) - Entity class (going to hold all of the stuff about the player ie: health) - Player class (Holds all of the player movement and the ImageIcon for the player) - KeyAdapt class (basically returns the key presses and returns them to the player) - Home class (the map itself) Now I don't have any idea on how to make it so you only view a part of the map. And as well my map isn't working at all. I'll upload the 2 files (Home.java and GameFrame.java) so you guys can look at the code. Even if you guys just know the sudo code for a solution to this problem that would be wonderful, in fact any input would be amazing ![]() |
Author: | Raknarg [ Wed Jul 03, 2013 8:36 pm ] |
Post subject: | RE:Java Game Help |
Is your map physically separated into tiles? What I did was I created different pictures for each kind of tile. Then I told my program if the tile is within the screens bounds, then draw it. It takes more work but that way its easier to work with and its more customizable. |
Author: | Luca3490 [ Thu Jul 04, 2013 12:10 pm ] |
Post subject: | Re: Java Game Help |
yeah i tried doing that, but I have never done 2 Dimensional arrays and then assigned it so each number represented a picture. do you happen to have any source code i can look at? ![]() I've tried googleing both questions I had but nothing really helped :/ |
Author: | Raknarg [ Thu Jul 04, 2013 5:46 pm ] |
Post subject: | RE:Java Game Help |
hmm... I've never worked in java, so I can try whipping up some pseudocode for you. If you knew turing, I could make a real example. |
Author: | Raknarg [ Thu Jul 04, 2013 6:09 pm ] | ||
Post subject: | Re: Java Game Help | ||
This is a pretty rough idea. You initialize the array, the read through a text file and set each element to the same point in the file. After that, you just check to see if it's in range of your character when you draw it. If you want, I can explain 2d arrays better. againm if you knew turing (or Processing, by chance) I could make you a real example. |