Hello guys and gals!
I have been prototyping an RPG Party System whereby you have several characters and can TAB between them.
The camera pans smoothly to whichever character is selected and has a smooth lag effect when the character moves (I can also employ the Screen Shake effect later, as I'm using Scroll-to).
I first created this without any Arrays or Families and it worked perfectly, but I would like to make it more flexible to future-proof it for changing Party sizes when members join and leave (or die).
I also have future steps planned such as a loop to fill the array, but I'm trying to take baby steps here <img src="smileys/smiley2.gif" border="0" align="middle" />
I haven't used arrays in construct before and don't seem to be having much luck. My array is simply 3 X values: 0, 1 & 2 (a 3x1x1 array).
X0 stores the UID of Char1, X1 stores the UID of Char2 & X2 stores the UID of Char3.
I increment the Global number PlayerSelected to allow me to select different X values within my array (which in turn should refer to the different Characters, allowing me to cycle through them).
I seem to succeed in everything up to (and including) unpinning the Player Controller from the current Character, but once I increment to the next Character, the Player doesn't want to move over there and be pinned to it, he just wanders off and leaves the first character behind.
Here is my initial setup:
<img src="http://img547.imageshack.us/img547/1651/tabcycle1.jpg" border="0" />
Here is how I handled the Character cycling previously, which worked as intended:
<img src="http://img708.imageshack.us/img708/8286/tabcycle2.jpg" border="0" />
Here is how I am trying to handle it now, using the same logic as before:
<img src="http://img16.imageshack.us/img16/1705/tabcycle3.jpg" border="0" />
Here is the capx:
I am planning to turn this into a tutorial once I'm finished and any help would be appreciated <img src="smileys/smiley36.gif" border="0" align="middle" />
I have added a line to check that the incrementing is working (and it is):
<img src="http://img259.imageshack.us/img259/2821/tabcycle4.jpg" border="0" />
It counts up to 2 and then goes back to 0. So it just seems to be the last part of the new formula that doesn't work. <font color=black>Maybe I can't get a new instance of PlayerChars within the same condition, after getting the first??</font>
I'm not really sure.
Develop games in your browser. Powerful, performant & highly capable.
Ok, I think that was the problem. By taking the first PlayerChars instance-picker condition, and giving it it's own sub-condition, the second PlayerChars instance-picker condition now fires (whereas previously it wasn't firing at all).
It seems that upon a condition picking one instance (or a group of instances), a sub-condition of this is unable to pick a different instance outside of what was already picked (but can possibly pick instances from within the first selection - I haven't tested this), and thus any associated actions never fire.
Therefore, I assume that the original sub condition wasn't working as it was trying to pick an instance outside of what was already picked in it's parent condition <img src="smileys/smiley3.gif" border="0" align="middle" />
By removing the pick-instance from the parent condition, the 2 sub instances are free to pick different instances of their own choosing <img src="smileys/smiley2.gif" border="0" align="middle" />
If anyone can confirm this it'd be great!!
Here again is how I was trying to do it:
And here is the solution:
<img src="http://img441.imageshack.us/img441/2541/tabcycle5.jpg" border="0" />
Note: I also added a text line for debugging purposes and I have updated the capx with the solution <img src="smileys/smiley2.gif" border="0" align="middle" />