Fruit Machine

3

Attached Files

The following files have been attached to this tutorial:

.capx

demo-fruits.capx

Download now 1.49 MB

Stats

4,900 visits, 7,217 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 23 Aug, 2014. Last updated 19 Feb, 2019

There isn’t day going by and someone ask when are you going to do my request or send me how to do this or that. Some ask how I can manipulate some code to do slot changing graphics or some kind of loops to make sprites change and so on...........

Today I will teach you how to make slot machine (Fruit Machine) game. There are loops and more checking so please make sure that you insert code properly.

Let’s start Construct 2 and create new project

1. Name it Fruit Machine

2. Set window size to 640 x 480

3. Set layer size to 640 x 480

4. Use any Background colour

5. Add mouse

6. Add audio

7. Add Function and call it CheckFruit

Now let’s create sprite and name it Fruits and size about 80 x 80.

Now set instance variables and call it FruitNumber

No behaviour for the sprite Fruit

Now add 7 more frames with different type of fruits

Set Animation frame to 0 (Zero)

Set loop animation to Yes

Add text and name it txtMoney

Add another and name it txtinfo

Create button object and call it Click me! Or whatever you like

Your screen should look something like below:

Click on events and let’s add Global Variables

For txtMoney we can say Money = 0

Now we need another for Rolling our fruits therefore call it Rolling = 0

That’s done we can start by entering code

Start of layer

Now let's create loop to Roll our Fruits so add these lines

We create Function CheckFruit and some Local Variable. If you do not know how to add Local Variable then Read the C2 Manual Please and Do remember not to ask me how

That is it. Your task is to build more function, sprites, animation and so on

Happy Learning Construct 2

.CAPX

demo-fruits.capx

Download now 1.49 MB
  • 0 Comments

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