Am I making one of those errors I'm going to laugh at later? Or am I just misusing the method.

My method instantiates the map, sets the blocked array to the size of the map (in tiles as per the Slick2D method).Then it loops through the map, checks each tile for the given property, in this case "blocked" defined with "true".And finally, if the value is true, it adds that tile to the array.

Currently, it is passing every single tile to the array as if it is ignoring the properties set in Tiled.

EDIT: In the meantime I've resorted to using the TileID instead of the tile property which works, but feels a bit cheap since I want to do more complicated things later. I'd rather have the code more readable by using "blocked", than by having magic numbers everywhere.

EDIT2!: After some frustrating fixes I have collision working (badly) and have come to realize I just don't know what the hell I'm doing with floats. My collision check takes in a float, and my array has to check an integer value and return true or false. I thought I was smart taking the player position it was checking and dividing that by the map's width or height (for x and y) which put the collision near where it should be... but it's acting strangely, letting me move halfway through some blocks before I collide, and occurring on some tiles it shouldn't.

To keep everything cleaned up I was going to keep the first layer strictly background. The next layer would be collision (and maybe movable objects if I can get this project moving), and then an object layer for collectables/items.

My programming is a bit rusty! My loop seems to think every tile has passable as false. Gonna have to double check my loop. My reward for fixing collision tonight is sleep!

And while I'm at it I should clean up this bit of code I have so in Init() I call a Map Loading method instead of all the messy code. It's all coming back to me :]

Slick2D warns that its getTileProperty() method will not perform well.Is it a viable way to implement collision despite the warning?For example setting either a tile or object in Tiled with properties "passable" and "false", then iterating through the map when it is instantiated and adding all appropriate tiles to an array?

Interesting! For some reason subtracting the Cameras x and y was keeping the player from moving, when all it did before was keep the screen centered on the player and allowed the camera to "follow" it. Now I need to find a way to fix the camera again >.< the endless joys of programming

I threw some print statements in tileMovement() to confirm that the players position is changing. It does infact change, so the key events are being handled correctly. Movement update is being called in the players update() method, which is called in the game loop.

At the moment, the players x and y get changed, but nothing occurs on the screen. Before I had changed how the map was being loaded, the movement was great, perfect for what I was going for actually. The only thing that changed was the map rendering.

The magic 15 is how far the player moves. It's half the length of one of my tiles.

Sorry about that >.< I do tend to get off track pretty easily.I'm looking specifically at the render method, renderMenu and renderBattle are working fine atm. I kinda fixed the first problem, the loadScene method was being called over and over, and then I realized it was inside my game loop. After I moved it, it loaded the scene properly, but when it goes to draw and calls render I get a NullPointerException and the game closes.

/** * this class was originally meant to simply hold a reference to a map * and a collection of sprites, which it delegated all the work to in the * logic and render methods of these objects...<p> * * so it is reasonably fitting that this class also manage the loading of the * maps and sprites it uses from files or URLs.<p> * * Each scene consists of a Map, and a collection of sprites, as intended, * but may also be loaded or saved. */publicclassScene{intoffsetX = 0;intoffsetY = 0;

EDIT: Cut down on the giant first post. Also the second problem has been fixed. When I moved the loadScene, there was no scene to render in the Draw class, hence the NullPointer. But now that the map has been drawn, I am still unable to move around despite having been able to before I changed how the map was drawn.

publicvoidkeyReleased(KeyEventkey) {switch (key.getKeyCode()) {caseKeyEvent.VK_UP:Instances.player.setUp(false);System.out.println(" Released UP!");break;caseKeyEvent.VK_DOWN:System.out.println(" Released DOWN!");Instances.player.setDown(false);break;caseKeyEvent.VK_LEFT:System.out.println(" Released LEFT!");Instances.player.setLeft(false);break;caseKeyEvent.VK_RIGHT:System.out.println(" Released RIGHT!");Instances.player.setRight(false);break;

Wow so many replies! I see a lot of good things that will help me rewrite my mess of a program Medals for everyone! I'm still open for more input; it's likely that I'll try everyone's examples that they posted and see which one will fit bestwith the way my team wants the game to feel.

I'm still in shock that everyone has been so helpful and noob friendly. I think I'll be spending quite a bit of time here as I develop my java skills

And I guess to cut back on spam, I'll just continue to use this thread in-case I need help with anything! :]

What exactly do you mean by:"Do you have any input on items A-F at all, or anything else to add?"?

Next, I think you'd be better off rewriting everything a bit. Wat you are doing will be fine for small games. But it will be really chaotic if you make a bit bigger game. I suppose you have 1 class in which you both handle the movement, and the drawing?try and make it more like this:Draw class, in this you will draw everything.Player class, will handle movement and collision detection.In your player class youll need 4 funtions, 1 to handle the keyrelease, one to handle the keypress, an update function (So your player actually moves) and a draw function)I would love to explain it in detail, but my next lesson is starting soon. Ill explain it in detail asap (that is today, and when nobody has done it yet)

Forgot to quote ReBirth on that post haha, whoops!

No, I perfectly understand what you mean. The code I posted was from the Main, so it looks like I'll be doing a lot of work today on the other classes, and calling them from Main to see if it all works But if you want an idea of how chaotic it would have been...all the drawing, movement, tiles, etc were all in the Main. The only thing I called from the Player class was the coordinates LOL.

Welkcome to JGO!First of all with an applet you can easily show it from a webbrowse, where as a application is more for standalone purpose (this is what i know). For releasing it to the public, depends on what end. You mean selling? Or just freely distribute?

secondly, sure thats fine to do. Just think that it will save the images in the ram as you load them. So unless you are going to load huuuuuge maps at once, it should be fine. Look at one of my previous posts, i explained how you can easily set up a tile based map (Like what you are doing).

thirdly, i have had this problem as well, had to change a bit of my code to change it. Do you mind posting your movement code? So that i can help better with that.

for your savequestion, i have no clue. It should have acces i believe (i can easily store text documents and such) what are you using to save it?

And the library, i have not much information about this, but i believe that the original java libraries are more then fine, if you are not planning to use image scaling and transparancy (because this is supposed to go 'slow').Also, if you are looking for another member, id love to join . Programming in a group is so much more fun then doing it alone. Im currently making a rpg as well. Which is going quite alright (Finished inventory, scrolling map, movement engine, movement) so i think im able to help you guys out! ^^

1) Awesome! We plan to freely distribute it depending on how it turns out.

2) I will definitely give your post a look. That should solve most of our problems with thinking the map will be too big. I'm assuming we would need some sort of event upon entering a door or such that tells it to load the map of the building, etc?

Ignore the test messages, I added those to see if the applet properly kept track of which keys were down/released.

4) We were trying it using print writer. My friend took care of that portion because I haven't personally done any file IO in java, only python in an intro programming course.

5) I think that would be great! :] We're trying to get more people on our team, ideally all in person so we can meet up and actually work for a few hours and not slack off on our own! If you have any extra time on your hands though, I think that would work out. I need to run it by them first though, or else we'll end up having another 10 people with access to our DropBox and that could get messy

Hi there JGO community!I just started working with a team of friends on a 2D RPG.We only have about a years worth of experience in Java in our College/University.So far we have written everything from scratch and haven't used any external libraries (everything is in javax.swing)Before we get any further than we are now, I'd like to stop and ask questions to see if we are on the right track,or if we are failing horribly and need to do things differently. The only things currently working are the map loading to the screen, and character movement. No collision yet.

A) The game is currently running as an applet. If the game doesn't turn out as horribly as we think it might, we will considermaking the game available to the public. Is this a viable way of putting the game out there? Or are there better solutions?

B) The map is stored as an array of ints. Each int corresponds to a tile in a switch statement. We currently only have about 10 tiles... but with any more I KNOW this will turn out bad. My idea was to have a tile class and work from there. Does that work?

C) When holding down a movement key, java starts to read the input about as fast as you can type in a text file by holding down a key. Is there any way to limit the input so the movement becomes "fluid"? It currently turns out as one step in any direction, followed by a slight pause, then the character will take off sprinting in that direction.

D) We were probably thinking too far ahead, but we tried making a save method. It gets called when a button was clicked on the applet, just as a test. It then exports the character position into a text file using PrintWriter, which could be loaded later on. Doing so would completely freeze the applet. My professor mentioned that the applet doesn't have permission to write on the C drive, and that may be why the applet freezes. Is this just a hindrance on our applet choice again? If not, are there ways around it?

E) As I mentioned we are only using java strictly and currently do not use any external libraries. Is there any merit at all to writing the game this way?Or should we start from scratch using something like slick2D? We are doing this as a learning experience and hope to be professional game developers someday. Is it worth it trying to "reinvent the wheel" so to speak and design the engine the way we are now? Or would we be better off implementing the things others have already figured out?

F) Probably the most important thing in my opinion to learn well at this level: ORGANIZATION. I feel as if we are doing too much in the Game class, and not enough in classes like Player, etc. How much should be done in the actual Main program? How much should be handled elsewhere? I know most organization is a matter of taste, but what has worked for you as far as doing things, and where you do them. The most typical error that I keep encountering is making a static reference to a non-static method/value which usually pushes me to write more in the main and less in outside classes.

Sorry for the extended noobness, but even the questions I thought would be simple on these forums turned out to be quite ahead of where I think we are as developers. Any help or ideas would be greatly appreciated (and also gets JGO in the credits when we finally finish a project )

EDIT(added (F) and this-->) FYI if anyone wants to see the abomination that is our current source code, feel free to ask. Your eyes may burn from looking at it.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org