This tutorial will teach you how to create a warp appearance effect like at the start of the Futurama title sequence. The effect will look something like this:
In order to make this, you will need three simple things: an object like a ship, a blue spike, and a flat ball:
Begin by creating the alien ship on screen:
[Alien] Graphic = AlienGraphic Position = (0, 0, 0.5) ChildList = WarpAppearance [AlienGraphic] Texture = ship.png Pivot = center
Notice the WarpAppearance
object added to the child list. This is where the appearance affects will be added. Whenever an instance of an alien ship is created, a nice appearance effect will show with it.
Define WarpAppearance
with:
[WarpAppearance] AngularVelocity = 100 ChildList = WarpSpineMaker LifeTime = 4
WarpAppearance
is just an empty object that is turning. This object will only live for 4 seconds, then it will die. Attached to this (as a child) is WarpSpineMaker
.
Create WarpSpineMaker
with:
[WarpSpineMaker] Spawner = WarpSpineSpawner Position = (0, -3, 0) [WarpSpineSpawner] Object = WarpSpine ActiveObject = 40 WaveSize = 5 WaveDelay = 0.1 CleanOnDelete = true UseSelfAsParent = true
WarpSpineMaker
has a spawner defined (WarpSpineSpawner
). WarpSpineSpawner
will spawn loads of WarpSpine
objects, which are the blue spike texture as above.
[WarpSpine] Graphic = @ Texture = warp-spine.png Pivot = (17, 202, 0) AngularVelocity = -200 ~ 200 FXList = FadeInOutFX LifeTime = 1.0
This is the interesting part. Each WarpSpine
object that is spawned by WarpSpineSpawner
has a low centered pivot point and a random spin value. Each only lives for a second, but this gives a “filtered light” effect. To smooth the appearance in and out of each object, a FadeInOutFX
is defined:
[FadeInOutFX] SlotList = FadeInOutFXSlot KeepInCache = true Loop = false [FadeInOutFXSlot] Type = alpha Curve = sine StartTime = 0.0 EndTime = 4.0 StartValue = 0.0 EndValue = 1.0 Absolute = true
Add a small piece of object creation code to your project's init()
function:
orxObject_CreateFromConfig("Alien");
Compile and run. The ship will appear with a dazzling array of blue spines surrounding it.
For a minor enhancement, we'll also spawn some randomly coloured balls to act as a type of lens flare. Change the WarpAppearance
to include a child called BubbleCreator
:
[WarpAppearance] AngularVelocity = 100 ChildList = WarpSpineMaker # BubbleCreator LifeTime = 4
And it is defined as:
[BubbleCreator] Spawner = BubbleSpawner LifeTime = 3 [BubbleSpawner] Object = Bubble ActiveObject = 24 WaveSize = 2 WaveDelay = 0.1 UseRelativeSpeed = true
BubbleCreator
only lives for 3 seconds in total and has a spawner called: BubbleSpawner
. It in turn spawns objects called Bubble
:
[Bubble] Graphic = @ Texture = glow-bubble.png LifeTime = 1 Speed = (-250, -250, 0) ~ (250, 250, 0); Scale = 0.5 ~ 1.0 Pivot = center HSV = (0.0, 1.0, 1.0) ~ (1.0, 1.0, 1.0) FXList = FadeAwayFX
These shoot away in random directions, have a random colour and size. They also fade nicely away with FadeAwayFX
, which we'll define here:
[FadeAwayFX] SlotList = FadeAwayFXSlot KeepInCache = true Loop = false [FadeAwayFXSlot] Type = alpha Curve = linear StartTime = 0.0 EndTime = 0.5 StartValue = 1.0 EndValue = 0.0 Period = 0.5 Absolute = true
Run that and the alien will appear in a wash of blue spikey light and coloured flares.