

            Combination Switch Lab



**************** AXE-AMIN THIS ***************

Imagine a set of frames, for example:

[1] [2] [3] [4] [5] [6] [7] [8]

-(data3)-
This sequence has 8 frames, the number goes 
into DATA3 of the ComboSwitch.
This is called the LENGTH value.

-(data2)-
Then we have to mark the frame for the
ComboSwitch's ON state, let's say frame 5
the number goes into DATA2 of the ComboSwitch.
This is called the GATE value.

-(data1)-
And we have the option to set the initial
starting frame in the sequence, this number
goes into DATA1 of the ComboSwitch.
This is called the INIT value.

On the sprites visual side (in 3D mode)
DATA1 is the OFFSET of the tilenum.
So for example if you applied tilenum 10 to
the sprite in 3D mode and changed DATA1 to
say 3 than the sprite's appearance is that
of tilenum 13.
Furthermore, there is a distinction between
TILENUM and PICNUM, a Picnum is just 1 single
frame but a Tilenum can also be an animation
and will therefor skip the number of used 
animation frames to display the next Tilenum!


************* THE INNER WORKINGS *************

Now, each time the ComboSwitch receives an ON 
it will increase DATA1. 
In other words, this is the POINTER value in 
the sequence, so the pointer advances 1 step.

The position of this POINTER is compared by the
value in DATA2, when both are TRUE (equal) it
will switch the ComboSwitch State to ON,
when FALSE it switches to OFF again, so:

   [1] [2] [3] [4] [5] [6] [7] [8]
   off off off off ON  off off off
    0   0   0   0   1   0   0   0

The POINTER's position is also compared by
DATA3, when TRUE it will reset the POINTER's
position to 0 (the 1st frame).

A trigger occurs when the POINTER is GOING TO
a value (so NOT when EQUAL TO).

The rule of thumb here is that DATA3 
is ALWAYS greater than DATA1 and DATA2
and in most cases DATA2 is greater than DATA1,

  DATA1 < DATA2 < DATA3

In summary:

DATA1 is the POINTER and OFFSET for Tilenum
DATA2 is the COMPERATOR
DATA3 is the SEQUENCE length
DATA4 is the SOUND (for each step)


***************** AN AXE-AMPLE ****************

- In 3D mode, point at wall and press [ALT+S]
  click [MISC] and select button
  change tile to #4208
- switch to 2D mode and set:
  
  Type 22: Combination Switch
  TX ID: 1000
  CMD: State
  [x] going ON
  [x] going OFF
  Trigger On: [x] Push
  Data2: 5
  Data3: 10
  Data4: 207

- Hit ENTER to confirm
- Insert another sprite and set:
  
  Type: 708: SFX Gen
  RX ID: 1000
  DATA2: 270

- in 3D mode, make SOUND sprite invisible [I]

===============================================
                                BME 29 nov 2018
