Page 1 of 1

PROBably PROBlem with my version :(

PostPosted: Mon Dec 26, 2011 12:18 pm
by QbiWan
Hi. I'm new here.
I have some problems with Global Code Editor. There's tutorial on:

http://game-editor.com/Creating_board/strategy_games

I wanted to follow it a little, but when i pasted the code:

int findcell(int xx, int yy) //returns the current cell
{
int vcell=round((xx-controller.x)/32);
int hcell=round((yy-controller.y)/32);
int mycell=vcell+(hcell*10);
return mycell;
}

i saw this:

GE Error.jpg


What is going on?? What kind of mistake did i make??

Re: PROBably PROBlem with my version :(

PostPosted: Mon Dec 26, 2011 12:44 pm
by schnellboot
you need to create an actor named controller

Re: PROBably PROBlem with my version :(

PostPosted: Mon Dec 26, 2011 1:33 pm
by QbiWan
THX :)
But why tutorial didn't mentioned it??
And how this actor should look like (actions, parent, normal/wire frame, etc.)??

Re: PROBably PROBlem with my version :(

PostPosted: Mon Dec 26, 2011 3:31 pm
by Jagmaster
Create an object to handle all the pieces. This actor will be off-screen, and all pieces will be children of this actor. In this way, you can then move this actor at will to move the entire game board at will!


Since the controller will be off-screen you would be safe with a normal actor. In fact, most of the time, if it's not specified, you should use a normal actor.

Now I have a question, I thought you couldn't manipulate actor variables in global script unless you commented the name of the actor at the beginning of the script. Are you still able to read them without doing any of that?