Hex&Chit boardgame framework for blitzMax
BlitzMax Forums/BlitzMax Programming/Hex&Chit boardgame framework for blitzMax
| ||
https://www.dropbox.com/s/8r0rka8fa7r3xk2/HexGameFrameworkStart01.bmx?dl=0 I cant get the code archive to accept this code, can someone try it its a Hex&Chit boardgame framework for blitzMax |
| ||
It might be easier to read if it has indentation ... .. but it won't let me post it here - probably to do with the arrays (square brackets and things). Anyway, as a "thing", yes, it draws some nice hexes on the screen, but otherwise it's not very useful : Everything is hard-coded - the size of the hexes, the maximum grid size (i.e. your screen). You can't even change the origin of the grid (i.e. where on the screen you draw it) without a significant rewrite. There are also better ways to calculate even numbers than this : If x1 = 0 Or x1 = 2 Or x1 = 4 Or x1 = 6 Or x1 = 8... etc ... which again, is hard-coded to a fixed grid size. You can use 'x1 mod 2' if you must, but another possibly more efficient way is to calculate the even column with 'x1 & 1 = 0' The code is not at least "Strict", so everything is an "Int", which isn't useful for most people. It may be better to have your gameboard use Types instead, rather than just being able to store a list of numbers. I prefer to separate my board from the units/chits, as the board is generally a static thing. I also build my map with hex images/tiles, rather than a single, large background map. With tiles, you can more easily make very large, scrolling maps - re-using tiles throughout. Each tile itself is an Object which can store lots of information - but nothing related to units. etc... :-) |
| ||
There is a bug in the forum code where it errors out when you get something like "varname1 = 0" (in a comparison statement) so you have to change the varname so it doesn't end in 1 and it will work.Global x2 = 0 |
| ||
Ah, that will explain why I had to chop that above example code down - there were many more Or parts there, but it crashed the server (literally, it seems, or it blocked me for doing so a few times). |
| ||
Thanks Brucey for your comments the reason I posted this short program, is I got asked many times, no seems to be able to find help on Hex & Chit games, a zillion of help files on Side scrollers but nothing for hex chit games. the code I did as I went I didn't plan it out, but I believe being able to click on a hex & a chit gets sets Shows the Math of a hexgrid game easier to follow, its a start point, I just made this game in 2 days with this code, so It may be of use to people with no idea of how to start. https://www.dropbox.com/s/s6k1oqb32jk6h1t/GladiatorAcademy04.zip?dl=0 Its all fun with blitz, I love the language and hope it goes on forever! I'm not a pro coder but I do my best brucey, thanks for your time looking at this code |
| ||
thanks munch, |
| ||
https://www.dropbox.com/s/p06qed63fog271a/GladAcademyMP05.zip?dl=0 now with computer opponant |