Skip to main content
gamedev.net
🔒 Locked

Board implementation in visual programming

Started by reean Sep 8, 2003 at 11:42 PM 8 replies 900+ views
Original Post
reean
reean
I''m working on a board game programming, and I have a question about it. How to make the board (the interface) that user will use to play the game? (I use boarland C++ Builder). Should I use image to represent the board? Or I have to use button? The board size is 19x19, so, should I make 361 small pieces of the board that user can clik and do a programming on each of that? (use on-click action?) thx
Sneftel
Sneftel
Yikes, no. Do one big picture. Determine, using math, which square was actually clicked in based on the location of the click.


How appropriate. You fight like a cow.
MelvinElvin
MelvinElvin
either way really would be fine. As long as you code it well enough, having 361 "tiles" for the board shouldn''t be much slower (do your best to keep each tile object as trim as possible). Plus having seperate tiles will make it a touch more robust and allow you to do some cool things with the board more easily (e.g. Raise the tile that the player''s mouse cursor is currently over a bit).
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
reean
reean
quote:
Original post by MelvinElvin
either way really would be fine. As long as you code it well enough, having 361 "tiles" for the board shouldn''t be much slower (do your best to keep each tile object as trim as possible). Plus having seperate tiles will make it a touch more robust and allow you to do some cool things with the board more easily (e.g. Raise the tile that the player''s mouse cursor is currently over a bit).


and, can I just make one function to control all that "tiles"? (how?) or still I have to do a single manual coding for each tile?
Penance
Penance
well is this in visual basic, basic.NET, c++? there are alot of IDE''s out there for every language. if it''s an object oriented language then make a button object!

if it''s VB, just create a Buttwhenclickedoned function and whenever a button is clicked, forward any relevent data like mouse position, tile state (occupied? active?), etc to Buttwhenclickedoned. Then just use a for loop to create your buttons where you need them when you start up your game.
reean
reean
quote:
Original post by Penance
well is this in visual basic, basic.NET, c++? there are alot of IDE''s out there for every language. if it''s an object oriented language then make a button object!

if it''s VB, just create a Buttwhenclickedoned function and whenever a button is clicked, forward any relevent data like mouse position, tile state (occupied? active?), etc to Buttwhenclickedoned. Then just use a for loop to create your buttons where you need them when you start up your game.


i use borland c++ builder..

reean
reean
can you tell me a more detail how to do that things?
law_zou
law_zou

So you are writing a Chinese Go game?I guess.

Just use image is ok.
MelvinElvin
MelvinElvin
quote:
Original post by reean
quote:
Original post by MelvinElvin
either way really would be fine. As long as you code it well enough, having 361 "tiles" for the board shouldn''t be much slower (do your best to keep each tile object as trim as possible). Plus having seperate tiles will make it a touch more robust and allow you to do some cool things with the board more easily (e.g. Raise the tile that the player''s mouse cursor is currently over a bit).


and, can I just make one function to control all that "tiles"? (how?) or still I have to do a single manual coding for each tile?


ummm, lost me a bit on what you''re asking for there. control the tiles how?

I''d really just have the tiles largely as data structures, pointer to the "piece" (or whatever is in your game), a position, that sort of stuff. Any actual manipulation (like picking or say raising a tile when the cursor is over it) should be done by an external piece of code. Maybe have a board object while holds a linked list of all the tile objects, and have the board do all the manipulation of the tiles and so on and so forth. This is just basic code structuring though and you should really do it however you want. I would keep as much code seperate from the Tile object as possible though, since you''ll have heaps of them you won''t want them taking up too much room in memory.
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
reean
reean
I make a game named Pente. It''s like a combination between othello and tic-tac-toe.

thx 4 everything

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.