Randomised Butterflies

1

Index

Attached Files

The following files have been attached to this tutorial:

.capx

butterflies.capx

Download now 175 KB

Stats

2,979 visits, 5,002 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 25 Jun, 2016. Last updated 19 Feb, 2019

Edit 16/03/17 I updated various aspects of this tutorial, as I learnt a little more about the engine.

In every level of my game I have butterflies, fluttering away in the back ground. They're all slightly different colours, different speeds, and different sizes, and in this tutorial I'm going to show you how to make them.

It uses several different behaviours and the Tint Effect.

Setting up the project

All you need for this is a simple, white coloured butterfly sprite, called it Butterfly. Right click Butterfly in the Objects window and give it the behaviours Custom Movement and Sine.

Spawning the Butterflies

Now move to the Event Sheet. As random is the name of the tutorial, we want our butterflies to spawn randomly.

New Event, go to System > Every X Seconds. We want A LOT of butterflies, so let's go for random(0.2,0.5). Add the action, select System > Create Object, select butterfly at random(50,600), LayoutHeight-Buttefly.Height/2

The X value depends on where you want butterflies, so feel free to chaneg that. They spawn on the Y exactly just below the layout edge

Make another event, once the butterfly's Y position is less than 0 (minus its height) it will be destroyed.

Butterfly Movement and Size

Add a new event, Butterfly > On created. Firstly Enable Custom Movement. Then set the Scale to random(0.5,1). Set the Sine Period to random (1,3), and the CustomMovement Vertical Speed to -(butterfly.sine.period*50).

This means that when the butterfly moves in a large arc (sine period) it moves faster, and will move slower if it's a small arc. But these values may not suit you, play about with them and go crazy!

  • 0 Comments

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