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
Sequence (i.e. switch) Question
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#1
Sequence (i.e. switch) Question

Hey everybody,

I've been trying to get a bit more experienced in coding and stumbled upon sequences / switches.

I understand the concept of the whole thing but this one thing that still won't get in my head (or maybe i'm just too dumb to read, idunno) is:

How does the iIntroPart Integer go from 1 to 2 or upwards? (best to look at the link above. The finished code is at the bottom of the page)

Because, as i've understood it, the cases go from case1 to case2 (and so on) if the parameter of the switch function changes to the according numbers.


I have the harsh feeling that i've just missread this whole thing or maybe i just interpret it wrong. Hope that you guys can help

-RaideX

If you don't draw first, you don't get to draw at all... -The False Shepherd
(This post was last modified: 12-04-2013, 04:00 PM by RaideX.)
12-04-2013, 03:59 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#2
RE: Sequence (i.e. switch) Question

AddLocalVarInt("iIntroPart", 1);

This will boost up the int each time the function is called again, taking it to the next step.


This:

partSpeed = 21.0f;

and this:

if (GetLocalVarInt("iIntroPart") <2)
{
AddTimer("tmrIntro", partSpeed, "introSequence");
}

...will determine that if the sequence is not yet finished then it will play the entire thing again after the time that was set in partSpeed in the previous one.

When time is up, and the function fires again AddLocalVarInt("iIntroPart", 1); will activate allowing the next step in the sequence to play out.

[Image: Tv0YgQb.gif]
Image by BandyGrass
12-04-2013, 04:56 PM
Find
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#3
RE: Sequence (i.e. switch) Question

oh. my god. I'm such an idiot!

I got confused with the AddLocalVarInt because i thought it was SetLocalVarInt....

It makes sense now! thanks alot.

If you don't draw first, you don't get to draw at all... -The False Shepherd
12-04-2013, 05:10 PM
Find




Users browsing this thread: 1 Guest(s)