Page 1 of 1
The New Question about ZGE :)
Posted: Sun Feb 18, 2007 8:55 pm
by turshija
I would like to know how to make something that would in C look like this:
struct {
int x;
int y;
} something;
and then in variables I add
something bla[5];
and use it with
bla[1].x = 5
Posted: Mon Feb 19, 2007 8:42 am
by VilleK
You need Arrays
Or some kind of list/vector.
Unfortunately that is not yet supported in ZGameEditor.
It is the same thing with connecting models, if you mean connecting
them they way like in a "snake" game. I cannot think of any easy way
to achieve this without adding more scripting commands.
The scripting language needs many more features. I will most likely
focus on adding this in upcoming releases. Or if I figure out a way
that doesn't require scripting then maybe that would even be better.
Posted: Mon Feb 19, 2007 6:49 pm
by turshija
Well I need arrays and some kind of structs ...
structs are same as records in pascal...
i have intention to make record named SnakeBody that has X and Y and make array of it like 1..MaxSnakeLength of SnakeBody but since its not supported in ZGE, I should wait a little bit
and one more question is what programing language do we use in ZGE ?
is that Java ? C# ?
it would be nice if we had an option that ZGE project converts to pure source code so It can be compiled with other compiler and you could modify source code to add something that is not possible from ZGE ...
Cheers
Boris
Posted: Wed Feb 21, 2007 11:56 am
by VilleK
You could make part of the snake a model, called
SnakeBodySegmentModel or something.
So you will have SnakeHeadModel spawning a SnakeBodySegmentModel
that will follow the head.
After a while a SnakeBodySegmentModel spawns a new
SnakeBodySegmentModel which should follow the segment
that spawned it.
However, there are still problems because a model cannot
get a handle to its parentmodel from expressions, yet.
Scripting syntax is based on a very small subset of C#.
Posted: Thu Feb 22, 2007 3:17 pm
by turshija
yeah ... my idea for snake is this:
make record snakebody that has X and Y that are integers...
spawn head and body should follow the head like this:
Code: Select all
body[0].X = head.X;
body[0].Y = head.Y;
head.x = {somewhere};
head.y = {somewhere};
do
body[n].X = body[n+1].X;
body[n].Y = body[n+1].Y;
n++;
while (n<snakelength);
and I add somewhere
Code: Select all
if (point.X == head.X) && (point.Y == head.Y) {
snakelength++;
score += 100;
{remove point model}
{spawn new point model}
}
things that we need in ZGE for this are structs (records) , arrays so we can make array of structs (records) and maybe file I/O for HighScore saving and stuff

well that is idea that I managed to do in pascal with weak dos graphics...

Posted: Thu Feb 22, 2007 3:22 pm
by turshija
yeah and the thing that I almost forgot is that I will add feature like good old Nokia snakes that can go through walls
Code: Select all
if (head.X>maxX) head.X = -maxX;
else if (head.X<-maxX) head.X = maxX;
if (head.Y>maxY) head.Y=-maxY;
else if (head.Y<maxY) head.Y = maxY;
oh yeah thats it