The New Question about ZGE :)

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

The New Question about ZGE :)

Post 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
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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.
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

Post 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
Yo mama's so fat that a recursive function computing her weight causes a stack overflow.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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#.
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

Post 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... :)
Yo mama's so fat that a recursive function computing her weight causes a stack overflow.
User avatar
turshija
Posts: 127
Joined: Sat Feb 17, 2007 9:26 am
Location: Novi Sad, Serbia
Contact:

Post 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
Yo mama's so fat that a recursive function computing her weight causes a stack overflow.
Post Reply