Korge Game Engine supports SWF animation files from Adobe Flash and Adobe Animate. It can either load SWF files directly, or preprocess them at compile-time in order to generate an optimized atlas-based version of the animation using Gradle and intelliJ plugins.
gotoAndStopwith constant values for simple flow
gotoAndStopwith constant values)
Adobe Flash/Animate just allows you to set instance names. But what if you could set custom properties to access them by code or to trigger behaviours?
KorgeEXT allows you to do exactly that. You can select any instance and define several properties (a set of key/value pairs or just keys). For example you can define a level, and set the gravity or physical behaviour of some instances.
You can use properties in three ways:
You can download KorgeEXT extension here: https://github.com/soywiz/korge/raw/master/korge-ext-swf/flash-ext/KorgeEXT-0.0.1.zxp
With Adobe Flash Pro, you can install it with Extension Manager. And for newer versions, you have to use a custom installer like ZXP Installer.
It is known that when the KorgeEXT panel is opened, triple-click doesn’t work. A workaround until fixed is to close the panel when triple-click is required, and reopen when you need to set custom properties.
In order to be able to configure how the atlas is going to be generated, you can
.swf.config file along your
data class SWFExportConfig( val debug: Boolean = false, val mipmaps: Boolean = true, val antialiasing: Boolean = true, val rasterizerMethod: Context2d.ShapeRasterizerMethod = Context2d.ShapeRasterizerMethod.X4, val exportScale: Double = 2.0, val minShapeSide: Int = 64, val maxShapeSide: Int = 512, val minMorphShapeSide: Int = 16, val maxMorphShapeSide: Int = 128, val exportPaths: Boolean = false )
You can preview ANI/SWF files (as they will look in runtime) right in intelliJ, using Korge’s intelliJ plugin (that uses Korge itself for rendering!):
Korge’s gradle plugin will generate
ani files for you automatically. So you can reference
.ani files instead of
.swf files and it will work.
Korge’s intelliJ plugin will generate an cache
ani files when you press play or debug so you can use them at runtime.
If you prefer to load SWF files at runtime instead of preprocessed ANI files, you can. You have to add
korge-ext-swf as compile dependency.
Then you can load it injecting as a dependency to your scene using
: AnLibrary type.
If prefer, you can also use the extension method
VfsFile.readSWF(views: Views) that will load you the
AnLibrary from an SWF file from any VfsFile.