AnimateObjectEx (SOLVED)

Started by Nine Toes, Tue 16/11/2004 21:41:37

Previous topic - Next topic

Nine Toes

Having some problems with a line of code:
Object 0 is a door.  I have the below code under "interact with object", interacting with the door causes it to open.  I have this set up with a room variable, so that once you open it, if you interact with it again, it closes.
Code: ags

if (frontdoorright == 0){
  SetObjectView(0,10);
  AnimateObjectEx(0,0,4,0,0,1);
  frontdoorleft = 1;
  }
else if (frontdoorright == 1){
  SetObjectView(0,10);
  AnimateObjectEx(0,0,4,0,1,1);
  frontdoorleft = 0;
  }


Now, the problem is:  the door starts out closed, and once you interact with it, the animation of the door opening plays.  However, if you click it again, the same animation plays, the door opens.

The Below code is for the other door next to it.  This code works fine, click it once, it opens, click it a second time, it closes.
Code: ags

if (frontdoorleft == 0){
  SetObjectView(1,10);
  AnimateObjectEx(1,1,4,0,0,1);
  frontdoorleft = 1;
  }
else if (frontdoorleft == 1){
  SetObjectView(1,10);
  AnimateObjectEx(1,1,4,0,1,1);
  frontdoorleft = 0;
  }


I'm hoping someone can point out what I'm doing wrong, I've been playing with this for an hour.
Watch, I just killed this topic...

strazer

You use the same variable (frontdoorleft) for both doors?

Nine Toes

Nay; each door has it's own respective variable:
object 0 = frontdoorright
object 1 = frontdoorleft
Watch, I just killed this topic...

Radiant

Yes, but you're confusing the two.
The top code checks frontdoorright, but sets frontdoorLEFT.

Nine Toes

#4
 :-\

Well, I thank both of you gentlemen for you help, and I sincerely apologize for being a dumbass.

I must be tired or something...
Watch, I just killed this topic...

SMF spam blocked by CleanTalk