|
12-12-2002 11:20
Posted by:
Davincho

|
Hello,
i'm thinking a strategic game and my first tool are tntbasic (my second preference is realbasic using class)..but i find some quetions:
1.- How i can "simulate" a data structure? (typedef struct {...} C/C++ style)...or tntbasic can make structures? SOme examples?
2.- Someone wrote one a-star algorithm with tntbasic?
thanks in advance and regards!
|
|
12-24-2002 08:42
Posted by:
Mark Tully
Location:
TNT HQ, England

|
Data structures
TNT Basic does not curretly support data structures, although we hope to address that in the future.
You can emulate it by using arrays.
For example a data structure from C that looks like this:
struct MyStruct
{
int x,y,z;
str name;
};
Can be done as a series of arrays
int kMaxStructs=50
int MyStruct_x[50]
int MyStruct_y[50]
int MyStruct_z[50]
str MyStruct_name[50]
Then you use the index into all these arrays as your 'structure pointer'. Eg, 5 means the values at index 5 in all of the MyStruct_ arrays.
Hope this helps,
Mark
|
|
01-08-2003 12:04
Posted by:
mark_667
Location:
England

|
star algorithm
Hi,
I think what you might be thinking of is the cursor function in one of Danlab's games, which makes stars fly from the cursor when hovered over a button. Danlab has very generously made this code avaliable to download from either their own wevsite www.danlabgames.com or you could get it from the uDev website, the game is called 'Twins Cards'
Hope this helps.
|