Choosing a character in a game

2

Stats

4,245 visits, 6,772 views

Tools

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 11 Mar, 2013. Last updated 19 Feb, 2019

Hi Constructors,

This tutorial shows how to select a character in a game.

Keyboard Controls:

Right Arrow

Left Arrow

Step 1

Load an image with a 4 frames in it and set the animation speed to 0. (see screen 1,2

Please note that each frame has its selections.

screen 1

screen 2

Step 2

Add the Events

Download the source link below.

db.tt/pjty3qK2

Demo link

db.tt/0THVrFAj

Summary:

The logic of this is when the user presses Right Arrow, "ctr" variable is incremented by 1 and when Left Arrow is press, "ctr" is decremented by 1.

Looping the Selections:

The last two events check the condition if "ctr" is less than 0, set the "ctr" to 3 then if "ctr" is greater than 3, set the "ctr" to 0.

Please note that if you have more than 4 frames or selections, you need to adjust the number "3" as to the number of selections you have or you can use "AnimationFrameCount".

Please note that I am new to Construct 2.

Enjoy!

-morex

  • 0 Comments

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