Ok, I'm convinced there is always a better way, and especially with the way I do things. Ok, the task here is to have the keyboard commands change based upon which animation frame is randomly generated by an object.
So, I have a square with 12 different animations. Each one is obvious like Apple, Orange, Tree, etc. The user (young student) must know the first letter of the picture to use the keyboard key that corresponds to that letter to initiate an action for the character. So, the character collides with a magic square and the active object becomes visible with the randomly generated frame showing. The user then acquires the new ability, let's say Super Jump (the ability to jump during a jump) only when they hit the keyboard key that corresponds to the first letter of that graphic. SO, if it were the Apple graphic that randomly came up the key for Super Jump would be A, the first letter of the word Apple. Ok, I have this working great, different randomly generated graphics are then mapped to different keys for the attacks. The user has a control panel and an icon of the random animation shows on the ctrl panel with the name of the attack, so the user sees an apple on his control panel and the word Super Jump above it, then they know to press A for super jump. If an Orange had come up they would press O for super jump, etc. SO, it forces them to know the first letter of pictures to play the game essentially and the pictures change often. A sneaky way to teach kids to begin to read... anyhow, here is what I'm doing to make this happen, and I'm SURE there is a better, easier way and considering I've only programmed two of these randomly generated abilities which change the attack keys, a better way would be great before I program 26 of them :-)
If you collide with the special marker a number between 0 and one less than the number of animation frames is randomly generated and the active object with X number of animations frames becomes visible with the generated frame number showing.
This sets a global SuperJump equal to the generated frame number and activates a group called Super Jump.
This is where I think a more elegant (instead of my hacked up) solution can present itself I'm sure.
The now active group has a check for each possible value of SuperJump
If SuperJump = 0 then activate the A group
If SuperJump = 1 then activate the B group
So, I then activate the group that corresponds to the letter A
It starts with 'Repeat while 'A' is pressed and then proceeds to do all the stuff I need the character to do to 'Super Jump'
I have a B, C, D, E, F, etc group that I activate if SuperJump = 2, 3, 4,5,6, etc. Each with the proper 'Repeat while 'B' is pressed, Repeat while 'C' is pressed, etc... each group has the proper keyboard key that corresponds to the animation frame value activated so that the user can now use the first letter of the graphic to make the Super Jump work.
So all this works but it is a huge number of tests to activate one of many many subgroups. If I could 'Repeat while (parse in my string) is pressed' I could cut out all those subgroups, for one... and there is probably a better way to assign the activation of the subgroups than by using a separate event for each possible value of SuperJump.
Is there a better way do this? I want the keyboard key that sets off my action to be reassigned based upon the animation frame number of a graphic that has that number randomly generated :-) I got it working and it is really cool, but clunky :-)
Thanks for help!