maandag 31 oktober 2011

Bought a Java Book - A natural introduction to Computer programming with Java

Last night I bought a digital Java book. It was only 8 euro's and I could pay directly through internet. I have been looking through the book and I see that it is a beginners book. There are over 600 pages of material. I already looked through the Array chapter but it did not have the multidimensional array setup covered. Though I will be using this book for studying. I still copy and paste and modify older sourcecode to make new things. So I need to learn how to code from nothing up to the end result. The last thing that I went through was classes. I worked with Types in Blitz Basic and I thought that classes replace this. Still I need to be certain that the applets work on this blog so I have some experimenting to do.
Edit: I found a older post from the blog here where I used linked lists to store classes into. Classes do replace types. You can even add functions to classes. There is a different class compiled for each class declared in the sourcecode.

Last night I also started working on a new example for my blog. A fog of war example. I am making a scrolling map where a oval is centered in the middle of the map that can be moved through the map. The fog of war is something that I programmed a number of times already. The map is covered in black and a brush in a array draws in a hidden_tiles_array where the oval is and sets the tile values to unhidden. This way when you move through the map the map becomes visible. The map draw routine draws the tiles and checks if it can draw a tile if the flag is set to unhidden. An extra map array is needed. I have selected a older example from my blog as a base for this fog of war example. I am hoping to finish the fog of war example today though I may do different things. But I placed the fog of war example on my to do list for the weblog.

2 opmerkingen:

  1. Hi! I've been reading your blog and have been having problems with the A* path finding example you made earlier, how would I go about making the search pattern larger than the 9x9 example?
    I read the code and made several edits but nothing I do seems to work, Help!

  2. In the Findpath method in the top there is code that exits the findpath method if the size is bigger then 9(start >). Change that 9 number to the size of your map. There are also hardcoded sizes for the pathfinding that goes to 20. Change those to the size of your map to.

    I was looking through the code quickly so I have no idea if I got all of the tips.

    I should of coded the example a little different. Make it so it supports different map sizes. But this code is one of the most difficult things I have ever made. It took me hours of figuring out how to do what it does. I was happy that it worked as it does.