Aa a AS3/Starling developer I trying to convert some of my games to html5. So I decide to use haxe-openfl.
My approach is similar as Starling: I load one big texture than get bitmapData from tileset and create DisplayObject(bitmap or Sprrite) and add it to displayList. Is this OK?
I also create custom MovieClip class to create MovieClips from sequence of bitmaps. Is there some builtIn class that I can create something similar or I miss something?
I know I can use tilemap, but I can’t see how to make object from tilemap (or tile) interactive for mouse click or simlilar.
You can use Tilemap as you said. As for interactions, you don’t need to add mouse click on each objects but you can add only one mouse click event, then you can loop on all your Tiles and check if the position of your mouse is inside one of your Tiles (you just need x,y,width and height). If you need pixel perfect detection, I don’t know if it possible with Tilemap yet. For animation with Tilemap, I don’t think there is a built-in class (I personnaly use Spriter).
But, did you check that Starling-openfl repo?
Well, when I said interactivity I mean: create button from bitmapData. As I said, I’ve already create functionality to grab bitmapData from tileset and provide it to custom sprite object. I’m just not sure is it good approach for html5 target (as mobile as well). My target is: load texture atlas and reuse bitmapData from it for everything-buttons, Sprites, MovieClips.
I can suggest you to go further in your approach. Maybe it will be good enough for your project.
Then, if you need optimizations because you can’t reach a good fps, you could try Tilemap or upload the Texture to the GPU to share between your differents objects as Tilemap does.
This part is interesting. I was thought that if I target html5 opengl “under the hood” do the magic. So I must upload it in GPU explicitly? How to do that?