HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.99k stars 438 forks source link

Compiling errors (Windows/Android/HTML5) #766

Closed moonpockets closed 10 years ago

moonpockets commented 10 years ago

Hey guys, it's Dan (moonpockets),

I've tried compiling to Flash, Windows, Android, HTML5, and Neko. Since I don't use Neko a lot, I'll just leave out the errors I have for that one (it's very similar to Windows). Flash works perfectly for me, I guess since this is optimized for Flash.

To start out, my first error with compiling was with Windows. These errors are not so much failing to compile, but problems with the program itself. Some of the sounds do not play on Windows, especially music. I also have keys 1-3 to select different musics, and tried to use them to enable the music since it wasn't playing in the beginning as it should be. Instead, this caused the program to crash. Also, the icon for my program doesn't work for Windows and the zoom/camera is incorrect.

Now - I have some problems with Android. It does compile, like all the others, but when I try to run it, it will not load, and also does not have the icon showing up either, just the default HaxeFlixel one. All I see when I try to run it is a white screen. I have tried to compile the FlxTypeText demo and it does indeed work fully functionally on Android, so it is probably my program.

Finally, HTML5. I am aware that there are many errors with HTML5 and it is still experimental, but my program doesn't work at all. Just a loading bar that is about 75% of the way.

I don't really need help for these errors, because I will probably be starting a better, cleaner, new project later on, but if you can give some help on these for future errors, that would be great.

Thanks, Dan.

Gama11 commented 10 years ago

Windows:

What sounds are you using? .mp3 for music won't really work there. Making sounds work cross-platform can be a bit of a pain, these are the two best options I think:

Regarding your icon issues, this seems to be a problem with openfl-tools. For now you can change the include.xml of HaxeFlixel I guess.

Could you be a bit more specific about "zoom/camera is incorrect"?

Android:

Might be a crash, possibly related to playing music?

HTML5:

There are safety restrictions with HTML5 which prevent you from loading assets from the local filesystem. To properly test a HTML5 game, you need to run a local webserver. You can:

moonpockets commented 10 years ago

I am using .mp3 for Windows actually. For the zoom/camera, when I start out my program, Flash renders the camera centered in on the player, while Windows shows him a bit off to the right or left.

For Android, it could also be my MenuState, will have to try that. I have the Menu before the game, so the music doesn't play until I press Single Player or Split Screen.

HTML5: FlashDevelop does not automatically run it for me - but it does build it. I can however, doubleclick on the index.html and that is how I load my html files (it opens up in Firefox). I'll try the haxeserver command.

Gama11 commented 10 years ago

Not much I can say about your camera issue without some example code reproducing the issue.

Your FlashDevelop version might be outdated, try getting the most recent one. That local server funcitonality hasn't been around for too long.

moonpockets commented 10 years ago

I don't really need the camera on Windows, not a main issue since I use Flash more for this program.

Also, I did look at my FlashDevelop and it said it has the latest version (no updates found). I believe that before, my local server worked but somehow stopped working.

By the way, do you know how to get the output tab at the bottom? I kind of deleted it... and only found out that the error with my music on Windows was this

Sound.hx:96: Error: Could not load "assets/music/Sycamore_Drive_Kicks.mp3"

after I used the newest FD. It is an mp3 so it probably can't load it because of that.

I lost my phone right now, so I cannot try testing the Android problems.

With HTML5, I tried running it on the "dlevel" FD, and the "master" FD, from the link you sent me, and I can say that it did open a local webserver, unlike my FlashDevelop for whatever reason. Although, it did open it on localhost:3000 instead of 2000. Both opened it, and ran the menu, but stopped working on the PlayState. I can at least run the program now, though.

Gama11 commented 10 years ago

I would still like to make sure there's no bug related to cameras which would need a fix.

By the way, do you know how to get the output tab at the bottom?

Did you forget to remove that sentence from your comment? Because it seems like you got the output panel back?

moonpockets commented 10 years ago

Well, I got the output tab but only on the FlashDevelop I downloaded. I want to know how I can put it back on the current FlashDevelop I use, because I have my files and project to the left, and some themes installed.

Gama11 commented 10 years ago

So I take it you didn't get the .exe installer but the .zip?

Either way, you can toggle any FD panel in the "View" section of the menu.

moonpockets commented 10 years ago

Yes, I got the .zip file. I wasn't sure if the .exe needed admin rights, but it probably did because it would have to install everything, and I'm not the admin.

Also, here is the Windows camera error I am getting: I have some camera code in the create function,

        // Editing the camera
        FlxG.camera.follow(player);
        FlxG.camera.zoom = 0.9;
        FlxG.camera.width = 1920;
        FlxG.camera.height = 1080;
        FlxG.camera.flash(0x000000, 4, null, false);

And in my update function, I put this for the cameras.

        FlxG.cameras.update;
        FlxG.camera.follow(player);

Not sure if I need it to constantly update the follow player, but I just put cameras update in there.

Now, I tried commanding out the lines that specify camera width and height.

        // Editing the camera
        FlxG.camera.follow(player);
        FlxG.camera.zoom = 0.9;
        //FlxG.camera.width = 1920;
        //FlxG.camera.height = 1080;
        FlxG.camera.flash(0x000000, 4, null, false);

It seemed to work, and zooming went back and forth perfectly (once it became a small box, was centered), while without commanding it out, the zooming out made a small box at the left.

This might be the error

I tried setting the camera.x and camera.y to counter the Windows camera not being centered. I added these 2 lines to where my camera settings were specified:

        FlxG.camera.x = 0 - FlxG.camera.width / 2;
        FlxG.camera.y = 0 - FlxG.camera.height / 2;

Flash still worked, and Windows also worked.

I guess the problem was:

Flash - Camera x and y sets automatically Windows - Need to manually set camera x and y (Only using a higher camera width and height than the screen)

Also, my FD localserver started working again.... That problem is fixed (and I'm still using my current FD, not new one)

moonpockets commented 10 years ago

@Gama11 By the way, I think I forked flixel-tools by accident. I can go ahead and delete that, right?

Gama11 commented 10 years ago

I can't really reproduce this, both flash and windows builds look exactly the same.

Why would you make the camera size bigger than the window in the first place anyway? To account for the smaller zoom I guess, but this seem excessively big, is you game actually full HD?

Also, the following two lines are completely unnecessary:

FlxG.cameras.update;
FlxG.camera.follow(player);

In fact, since the cameras are already updated by flixel you lose some performance and who knows what funky things might happen with cameras being updated twice per frame.

By the way, I think I forked flixel-tools by accident. I can go ahead and delete that, right?

Why not? Do you think the repo you forked it from would be deleted or what? :P

moonpockets commented 10 years ago

First - I was trying to find out how to make a higher resolution game, I wanted to make higher resolution characters, but the only way I could find was to make the camera size bigger and zoom out.

Also, I don't think the repo would be deleted, I was just wondering - dunno maybe someone needed it - but the last activity on it was a long time ago.

By the way - I found that if I removed those 2 lines (the camera update didn't do anything) but when I removed the follow player line, the game put the camera at the top left.

moonpockets commented 10 years ago

@Gama11 I guess this is done, you can answer and close if you want, whenever you are ready.