Luc Drenth

Ranch Hand
+ Follow
since Jan 15, 2019
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
13
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Luc Drenth

I am trying to convert a hexadecimal String to an int. If I use for examlpe

it would be valid code, but if I do

It will result in an error;
Exception in thread "main" java.lang.NumberFormatException: For input string: "0xff19aed8"
why does this happen and how do I fix this?
3 months ago
The program crashed before even drawing it. I loaded in all default tiles and eventually it gave me the error.
The code I used for loading in the default tiles;
5 months ago
Yes it does. I loop trough all the tiles and draw them to the screen.
5 months ago
I'll look into that then, since solving that possible problem would be much easier. Thanks a lot for your help! I really appriciate it.
5 months ago
I wouldn't know, I would think 1/7 but that would be a wild guess. (for reference, it's the pokemon Kanto region I tried copying it from).
5 months ago

Campbell Ritchie wrote:

Luc Drenth wrote:This array will have a size of about [9[9], so 100 chunks.  . . . .

You mean its largest indices will be [9][9], otherwise its size would be 81.


You're right, thanks for correcting me on that.

And no, it is a desktop application. Each tile holds an image of 64x64 pixels, 5 boolean values and 2 int values.
5 months ago
I tried that (actually tested it on a bigger level of 400x400 tiles) but I got an error about heap space. I thought this was because it would be to much to have 160.000 tiles in space.
5 months ago
This array will have a size of about [9[9], so 100 chunks. Each Chunk contains an array of [9][9] tiles and the player is in one of those tiles. When the player goes to a tile that is outside of it's chunk, it needs to load the next chunk and delete the previous Chunks.
5 months ago
I have an object Level, which contains a 2d array of Chunck objects. Chunk will have an array of 9x9 which will contain Tile objects. Is this not a good approach?
5 months ago
So that would mean if I just do something like

it will eventually be deleted by the garbage machine?
5 months ago
I'm working on a 2d tile based (pokemon) game and I want to split the map up in to chunks. Let's say my player is in the middle of a 9x9 chunk and I only want to load the chunks around the player (so 9 chunks). If I step in to a chunk that is around the player, I want one chunck to unload ofcourse. Problem is I have no idea how I would unload that chunk. I load it using serialisation, but how would I erase all data of that chunk as if it were never loaded?
5 months ago
Thanks so much guys! Problem solved (you were right Dave Tolls), code is a little bit cleaner and learned some things!
5 months ago
Thanks for the feedback. I now moved the list of Levels to the GameManager class and made it non-static and private. It did not solve the problem though.
(I did the same for the list in the ImageTile class)
5 months ago
The Level class has a static list that containts all Levels to I can for example display them all in my level editor using a for loop. Here is the Level class;


the Image Class;


the ImageTile class;


and the code that gets executed at the start of the program (only the code that relates to this topic beceuase it's a long function);


what I eventually wind up with is the I image I attached.
5 months ago
I populate the array using binary deserialisation


if, after the deserialising, I change the tileImage with another tileImage object it works fine.
so like this;
5 months ago