November 22, 2017, 01:05:53 AM

Author Topic: HaxePunk NME  (Read 5207 times)

Mar

  • Newbie
  • *
  • Posts: 11
    • View Profile
HaxePunk NME
« on: September 30, 2011, 03:33:56 PM »
Since NME recently released the 3.0 version I have been looking to move over to using nme to able to target other platforms. While it wasn't as easy to do as simply doing --remap flash:nme. I believe I have got most things working and you can currently find the changes on my GitHub page https://github.com/Marwes/HaxePunk. If Matt want's the changes into the main repository that would be great, however I'm a little bit wary at the moment so as to not break the existing flash target. From what little I have tested it should work fine even if you aren't using NME but I can't say for certain. If you are using NME it should work to compile for c++ and flash (not able to test anything else currently). Html5 does not work, however I will take a look at it during the weekend.

Notes:

Grid now checks for collision with an Array<Array<Int>> if not using flash since hitTest isn't implemented in NME. This should work the same as normal.

This also means the PixelMasks will not work on other targets than flash.

Image and SpriteMap classes have got an added name argument when created, this is to identify the individual bitmaps so that they are possible to flip (When using ApplicationMain.getAsset("...") you only get a Bitmapdata which does not have the identifying information of a unique class which you get when you embed images in flash).

Key.hx has been changed a bit for targets other than flash since the keycodes differ (lowercase vs uppercase).

tametick

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: HaxePunk NME
« Reply #1 on: October 29, 2011, 06:58:14 AM »
That's really cool!

NME is IMO one of the strongest reasons to use haxe at all over as3, so it would be really cool if this becomes the standard.

tametick

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: HaxePunk NME
« Reply #2 on: October 29, 2011, 08:40:03 AM »
BTW am I right in noticing you forgot to merge one small commit from HaxePunk in your branch?

https://github.com/MattTuttle/HaxePunk/commit/3e80f9d2a1a4c6a92788fd154d3d9162d54814e5

Mar

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: HaxePunk NME
« Reply #3 on: November 02, 2011, 03:15:53 PM »
Sorry for not responding earlier, it's just that I haven't had as much time recently due to university.

I noticed later that the fix didn't actually work (or rather it would only work for the first bitmap and not the rest). If you look in my branch you can see that Image takes another argument , name. This is because if you only give the bitmapData as an argument in flash it will not have the class "YourImageName" which it gets from embedding in flash which was used to store the flipped image.

Response to tameticks PM about the whether this would be merged to the main branch:

I actually forgot to ask Mattuttle if he wanted to merge it. I didn't ask immediently since I wanted to test it out first to see if it were working properly. I will probably do that though seeing how I have modified my code some more I may see if there is some more that should pushed as well ( I would have pushed this to github but I believe I changed some other stuff that others would not have use for so I ended up postponing the clean up due to lack of time). I saw that Flashpunk is updated tyo 1.6 so I may see if I can implement some of that stuff though I can't promise anything seeing how I only do this in my free time and school takes up qutie a bit right now (studying Physics not Computer Science so I can't even pretend it's for practice purposes =P).

Another thing though, seeing how hittest doesn't work for targets other than flash (thus limiting Haxepunk to only hitboxes, grids and circles) I have been thinking about implementing GJK or separating axes to check for collisions with polygons. If I get that working properly I will push that to github as soon as possible.

tametick

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: HaxePunk NME
« Reply #4 on: November 03, 2011, 11:58:08 AM »
Sounds good! I would suggest merging even if some functionality only works in the flash target, since it's easier to future users of nme to implement just these parts themselves (or not use them) than to redo all of your work (and since it doesn't hurt flash users anyway, there is no downside).

For example i use nme even for flash projecs because of the asset management alone.

mumuja

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: HaxePunk NME
« Reply #5 on: November 23, 2011, 02:10:05 PM »
how stable is haxepunk using NME? I'm really interested in using it for my next project :)
any outstanding bugs and all? How's the performance?

Matt Tuttle

  • Administrator
  • Sr. Member
  • *****
  • Posts: 309
    • View Profile
    • Matt Tuttle's Blog
Re: HaxePunk NME
« Reply #6 on: February 17, 2012, 12:59:33 PM »
HaxePunk actually works pretty well with NME now. I converted an old HaxePunk project in about an hour and it runs great. The controls weren't made for mobile devices but I had no problem loading the game on my phone. Obviously things would have to be tweaked to get everything running nice on mobile.

I also updated haxelib but have been some recent changes that will need to be added. The best way to get HaxePunk right now is from GitHub.