animated doors

Started by , Mon 14/11/2005 13:51:38

Previous topic - Next topic

c-king

Got some problems with animating objects. I have a closet door and when I interact with it opens but when I click again it start the animation again.

I need to open a closet then close it when I click again

Ashen

Just use a variable, e.g.:
Code: ags

if (doorisopen == 0) {
  // Door opening animation
  doorisopen = 1;
}
else if (doorisopen == 1) {
  // Door closinging animation
  doorisopen = 0;
}


(BFAQ entry on variables, if you're not sure how they work.) You could also use Get/SetGlobalInt().
I know what you're thinking ... Don't think that.

c-king

What do I need to put in 'doorisopen' It tells me its undefined.

(i'm still beginner)


Ubel

You have to put
Code: ags

int doorisopen;

in the very beginning of room script. (It has to be outside the door opening function)

Did you not read the BFAQ entry Ashen linked?

Ashen

#4
This page (scroll down to the bit about variables) might be a bit clearer. The short version is (as Pablo said):

Open up the Room Script for the room the door is in (Ctrl-E, or the '{}' button on the 'Settings' tab.)
At the top of the script, outside of any functions, put int doorisopen;


As I said you can use GetGlobalInt() and SetGlobalInt() instead. (Look them up in the manual for more details - they're built-in variables you can use instead of creating your own.) Take the chance to read through the BFAQ, though, as well as the other tutorial I linked.
I know what you're thinking ... Don't think that.

c-king

#5
Quote from: Pablo on Mon 14/11/2005 14:49:18
You have to put
Code: ags

int doorisopen;

in the very beginning of room script. (It has to be outside the door opening function)

Did you not read the BFAQ entry Ashen linked?

yes I just read but à never worked with variables before. Just trying to get the hang of it.


QuoteAs I said you can use........as well as the other tutorial I linked.

thanks, I shall read more about the variables

SMF spam blocked by CleanTalk