2

I'm trying to cross over to HaxeFlixel after learning of Flash's demise, but I'm not entirely sure how to bridge my understanding between the two. I'm currently using Visual Studio Code on a Mac.

In Flash(now Animate CC), you have a library full of symbols:

enter image description here

You can right-click and edit those symbols, such as setting a base class:

enter image description here

I have all of the .as base classes in my project folder and each one controls the Symbol(s). When I'm in VSC, I can create .hx files and I have a folder dedicated to images with all my game bitmaps in it. From there, I do not know how to recreate my game. What is a library of symbols, that I can assign base classes to, when coding in Haxe?

Joseph Wagner
  • 303
  • 3
  • 16

3 Answers3

3

You can use assets created in Animate with the Haxe library OpenFL. Here is an overview of how this can be done: http://blog.peteshand.net/load-swfswc-assets-into-haxe-flash-or-html5-targets/

user2630051
  • 119
  • 3
3

Also you could read official guide: http://www.openfl.org/learn/tutorials/using-swf-assets/

Andrew
  • 1,282
  • 6
  • 11
1

There's no library as you know it from Flash in OpenFL. If you look for "native" OpenFL asset handling look at the openfl.Assets class. It provides functions to load and parse several asset file formats.

If you need a class for your HaxeFlixel project that allows you to extend the basic functionality of a sprite you can extend FlxSprite and load the graphic/sprite sheet inside the constructor:

class Block extends FlxSprite{
  public function new(){
    super();
    loadGraphic("assets/images/block.png", false, 64, 64);
  }
}

You don't want to extend but just load the bitmap/spritesheet into a FlxSprite? Not much of a difference:

var block = new FlxSprite();
block.loadGraphic("assets/images/block.png");
add(block);

See also:

Malte Köhrer
  • 1,577
  • 10
  • 19
  • Yes, trying to do it the way it was done in the Flash ide might not be the best way. I'd rather attempt to do it the way it's intended in Haxe. I'm going to do the tutorial game first, but since you can't have library objects that target base-classes, is there even a point making separate classes for enemies? Things got pretty complex in my flash game, so I hope I can recreate that in Haxe without too much trouble. I don't know why people thought Flash users would enjoy migrating to Haxe.. – Joseph Wagner Oct 15 '17 at 02:57
  • It's hard to tell if it makes sense to create seperate classes without knowing your project. If you just use the class name to instanciate sprites the second HaxeFlixel option would work. Creating a Haxe project from your Flash code will take some time, it's usually doable though. Expect some learning effort though, OpenFL is not Flash, even though the API has many similarities you will see differences when switching platforms/languages. – Malte Köhrer Oct 15 '17 at 09:24
  • Doesn't it make sense, though? If you have 50 different enemies in your game, you would start with an Enemy class file that extends GameObject, then you could break it down even further. GameObject >> Enemy >> FlyingEnemy. From there, you can set the Linkage name to FlyingEnemy for any of your enemies that fly and that class will control them. If you want them to do something else, break it down more. For complex boss enemies, I had entire class files dedicated to them. GameObject >> Enemy >> DragonBoss. This worked, it was easy to edit, only now am I realizing how alien it sounds to people – Joseph Wagner Oct 15 '17 at 17:46
  • You still can do that, it's just not as flexibel as for example an entity component system: https://en.wikipedia.org/wiki/Entity–component–system. Really depends on your requirements and preferences. – Malte Köhrer Oct 30 '17 at 14:15