Can I use vector graphics in Haxeflixel (or through OpenFL)?

  • Good morning everyone!

    I've been wanting to recreate the game I loved when I was elementary: Stick Soldiers 2, which was just a simple straight-up 2D shooter with all sorts of easily customizable weapons and blocky terrain. When I discovered Haxe, and Haxeflixel, I was fascinated at the possibility of compiling to multiple platforms at once. I've barely used them technically; I've only compiled samples so far from flixel-demos to make sure they work along with doing the old Pong tutorial from haxecoder, so I decided eventually I'd recreate the old game to add much better stuff like missions and better team AI (the source code for SS2 from what I read on Wikipedia was lost due to a hard drive crash; the SS2 release going around for years is actually still technically incomplete, while plans to create SS3 had been sadly discontinued for a long time now as well).

    However I wondered if Haxeflixel, or more likely OpenFL which deals with graphics a bit more directly, could work with dealing with pure vector graphics instead of rasterized ones, to prevent issues with lines looking ugly on the stick figures if say sprites were used. Is it?

  • administrators

    OpenFL does indeed have an svg library. I've seen people use it for HaxeFlixel before.

  • My unreleased game Debatcles uses SVGs with HaxeFlixel for precisely that, stick figures. Well, and everything else in the game. :) As of January or February I was getting it to work OK on Windows, Android, and Flash. I couldn't get SVGs to work early this year.

  • administrators

    Are you using OpenFL's svg library for that?

  • @Gama11 Whoa! Sorry, big misinformation there. I was trying to use openfl's svg library, and because of whatever problems that I cannot remember right now, everywhere I was trying to use SVG I have replaced with prerendered PNGs. I'm glad you asked, I had made some poor assumptions there, not seeing the directory I had the PNGs in, only seeing the SVGs. The code and my project.xml revealed otherwise.

  • @IBwWG Out of curiosity, if you've tried OpenFL's svg library, what problems did you have with it? I rarely hear any people in the indie scene (at least based on google searches) use vector graphics in Haxeflixel since it's mostly delegated to dealing with sprites.

    @Gama11 Personally, is the SVG library recommended for usage in player characters as of this time? I saw that it's last update was January and it seems as if not much people are active around the Github repo, so I dunno. MIght consider sticking to sprites instead like SS1 actually did.

  • @rknonchalance I think it was something to do with embedded fonts. I had font paths used in Inkscape that came out all garbled. But I think even simpler parts of my SVGs were not always rendering correctly.

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.