Switching Between Characters

1

Stats

4,859 visits, 7,529 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 9 Oct, 2012. Last updated 19 Feb, 2019

Let it be noted that this was made with R105, so you will need to upgrade to view the final file.

Ever thought to yourself "I wish I could cycle my characers, but how do I do it ?" Well hopefully this will help.

In this tutorial we will be using three characters

Ever thought to yourself "I wish I could cycle my characers, but how do I do it ?" Well hopefully this will help.

In this tutorial we will be using three characters

After selecting and inserting your three characters, the first step will be to add a Global Variable and set up some simple maths. This Global Variable MUST not become a local variable at anytime, so please don't put it in a group, everything else can, but not this.

The first event states that when the Space Bar is pressed, 1 will be added to WhichCharacter. The sub-event makes sure that when WhichCharacter exceeds three (as there are only three characters) to go back to 1.

Next, you need to give each character the ability to move, for the purpose of this tutorial. As I have a license, I made a family and applied the 8 Direction behaviour. Alternatively, you could just apply it to each individual character.

Next you will need to add the following events, if WhichCharacter = 1, 2 or 3. And depending on the result, to start or stop ignoring the inputs for the associated character, like so.

The only problem with this code, is that if you have a large layout, then when you change chararacters, nothing will happen. This is why we included the scroll behaviour earlier. You will need to add a single action to each of the WhichCharacter comparision events events, so your code will now look like this.

Lastly, you will need to add an action, that will bring the active character to the top of the layer. Which will make your code look like this,

If you've done all this correctly, your file will look like the one attached at the end of this tutorial. I've added a background so you'll be able to see the movements properly.

I hope that this tutorial has been helpful, and if you have any questions or suggestions on how to improve, please don't hesitate to post :-)

===b[https://www.dropbox.com/s/xodai0n9ni78slh/CycleCharacter.capx]Final File===

  • 0 Comments

Want to leave a comment? Login or Register an account!