Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looping a "if statement"
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#1
Looping a "if statement"

Hey so I want to loop a if statement. The reason:
When the player collides with a Area I want the "if loop" to start and always check if the door is closed. When it closes (And believe me, it will get closed) some stuff will happen. But since I haven't done a loop, it only checks it once and it's not possible to have the door closed at that time, so I need a loop.

Here's how far I've gotten:

void Area_If(string &in asParent, string &in asChild, int alState)
{
if (GetSwingDoorClosed("Door_2") == true)
{
SetEntityActive("Monster_1", false);
SetMessage("Messages", "Text_2", 3);
}
else()
{

}
}


So when player enters Area_If, the "if statement" begins, but what do I write in the "else" statement in order to make it loop?

Appreciate any help!
(This post was last modified: 02-06-2012, 02:45 AM by Ninami.)
02-06-2012, 02:05 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Looping a "if statement"

Technically, a while loop is a looping "if" statement. But since a while loop that loops on to infinity will prevent the game from functioning, you should use timers.

Tutorials: From Noob to Pro
02-06-2012, 02:10 AM
Website Find
Ninami Offline
Member

Posts: 59
Threads: 6
Joined: Feb 2012
Reputation: 2
#3
RE: Looping a "if statement"

Oh my gooooooood, why didn't I think of timers!??! Big Grin

Tyyyy!
Works perfect!

+rep
(This post was last modified: 02-06-2012, 02:44 AM by Ninami.)
02-06-2012, 02:13 AM
Find




Users browsing this thread: 1 Guest(s)