Quote:
Originally Posted by Jiroxys7
And one more problem is that I don't quite know how to do is turn something like
PHP Code:
if(this.timeout1<=0.1&& !movementfinished && this.startershot=1){
doArcherShot();this.startershot=0;
}
into its own function. (If thats what you do anyway)
Sorry for the HUGE post.
|
You can put it in your timeout event.
PHP Code:
if(timeout){
this.timeout1-=0.1;
this.timeout2-=0.1;
if (this.timeout1 <= 0.1) {
doStuff();
}
}
function doStuff() {
if (!movementfinished && this.startershot==1) {
doArcherShot();
this.startershot=0;
}
}
Btw, does 'this.startershot=1' even work?
I've always thought you had to use two equal signs when comparing two things but I guess it might've worked in GS1.
You can't define a function on the serverside and expect to call it from the clientside. You have to use triggeraction, so try adding this to the serverside part of your code.
PHP Code:
function onCreated() {
setshape(1, 32, 32);
}
function onActionMoveArcher() {
//put your code here
}
function onActionDestroyArcher() {
//put your code here
}
Now change all instances of moveArcher() to triggeraction(this.x + .5, this.y + .5, "MoveArcher"); on the clientside and do the same for destroyArcher() except change the last parameter to "DestroyArcher".