Newgrounds is currently hosting a HaxeFlixel game jam! Nearly every single game I have made on NG has been made with HF, so I’ve been around the block with this little framework. HaxeFlixel has been pretty pleasant to work with for me personally, HOWEVER there are definitely quirks and odd things I’ve noticed here and there. To help all the potential newcomers to HaxeFlixel, or even programming in general, I’ll be writing a few tips and tricks posts here on NG.
At the end of each post I'll leave a few potential future subjects, leave a comment on which ones you'd like me to write up next.
Most of these will assume that you’ve been through a barebones tutorial of HaxeFlixel, probably the one on the HaxeFlixel website, but certain ones will be applicable for general programming knowledge.
Since this is on the frontpage I'll also use this as a little index
QUICK COMMAND LINE GUIDE
Here’s something that not too many give thought into for novice programmers. The command line can be a bit daunting for people who just want to dip their toes into frameworks like HaxeFlixel. Here’s basically most of what you need for basic HaxeFlixel navigation, installation, and general use. It’s not as scary as you think.
First off, to open the command line on WINDOWS, type ‘cmd’ into either Windows search, or press Win + R, then type in ‘cmd’.
THE CD COMMAND
‘cd’ stands for ‘change directory’. At least that’s what it does. Allows you to change directories. Say you’re in your user folder on your computer
It might look something like that. Let’s hop into our Documents folder
c:\Users\ninjamuffin99>cd Documents c:\Users\ninjamuffin99\Documents>
Easy as that, you just moved into your Documents folder.
Maybe you want to create your HaxeFlixel projects in a specific folder within your documents, one called ‘HaxeFlixel-Projects’. Easy. type in ‘cd HaxeFlixel-Projects’ (NOTE: for the sake of tutorial, create this folder in Windows File Explorer as you would normally create a folder, and THEN follow this step)
c:\Users\ninjamuffin99\Documents>cd HaxeFlixel-Projects c:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects>
Woah look at that you’re in… but how do you get out? Two periods, ‘..’, refers to the relative parent directory when it comes to all this fancy command line stuff. Right now we’re in ‘HaxeFlixel-Projects’, so ‘..’ refers to ‘Documents’. If you use ‘cd ..’ you will move to ‘Documents’
c:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects>cd .. c:\Users\ninjamuffin99\Documents>
Wanna use it again?
c:\Users\ninjamuffin99\Documents>cd .. c:\Users\ninjamuffin99>
Just like that you’re in your main Windows user directory. While this example uses Windows, the ‘cd’ command is pretty much universal across Windows, Mac, and Linux. Let’s go back to our projects folder. However this time let’s try out a quick little feature of most command lines, tab auto-complete. A few letters into typing the ‘Documents’ part of ‘cd Documents’, press the TAB key on your keyboard. It should autocomplete! It saves a bit of time, and I guess prevents potential typos. Try it with ‘HaxeFlixel-Projects’ as well, since that’s a handful to type out so often.
c:\Users\ninjamuffin99>cd Documents c:\Users\ninjamuffin99\Documents>cd HaxeFlixel-Projects c:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects>
There we go. That’s all nice and handy, but how do we even figure out what folders we can move into? How to we LOOK at what folders are in our current folder?
DIR / LS
dir (Windows) ls (Mac and Linux)
These commands work in pretty much the exact same way. They show you the current directory.
C:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects>dir Volume in drive C has no label. Volume Serial Number is 7CF9-09E9 Directory of C:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects 03/25/2020 12:04 PM <DIR> . 03/25/2020 12:04 PM <DIR> .. 03/25/2020 12:04 PM <DIR> Cityhoppin2 03/25/2020 12:03 PM <DIR> CoolGameHaha 03/25/2020 12:04 PM <DIR> Vervian 0 File(s) 0 bytes 5 Dir(s) 168,012,500,992 bytes free C:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects>
Typing in ‘dir’ will output something like this. This is what it looks like in Windows File Explorer
And that’s it! Simple command, but useful for knowing what is where. Assuming you went through the HaxeFlixel tutorial, let’s use ‘CoolGameHaha’ as our current project. (This should be a template file created by Flixel, don't know what I'm talking about? Go here)
c:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects>cd CoolGameHaha c:\Users\ninjamuffin99\Documents\HaxeFlixel-Projects\CoolGameHaha>
If you have Visual Studio Code installed (which is the recommended code editor), you will also have ‘code’ available as a command. It opens up whatever input directory into a new window of Visual Studio Code. We are going to use it to open up our current project easily.
This command is using ‘.’, a single period, as a directory. The double period ‘..’ refers to the current relative PARENT directory. A single period ‘.’ refers to the CURRENT directory. So run this should pop open Visual Studio Code in the current directory!
Now you can get working!
OPENING UP THE WINDOWS FILE EXPLORER
Maybe you want to open up the Windows File Explorer. You might want to drag and drop some files, or maybe you just want a nicer visual of your directories or whatever. From the command line this is done VERY easily.
Similar to the ‘code’ command, we are using it in our current directory.
Opens up this!
Finally, I’ll show you how to do it in REVERSE. What do I mean by that? I mean using the FILE EXPLORER to open up the command line in the current directory.
In the address bar of the File Explorer, you can type shit in
Click on it, type in ‘cmd’ and press enter
This should open up a command line in your current directory (from File Explorer)
If you’re a bit uncomfortable doing a bunch of command line navigation, this might be a nice in-between.
That’s it for this quick little guide, it’s not HaxeFlixel specific, HOWEVER I believe it’s still very useful for people who are new to HaxeFlixel, as HaxeFlixel often requires you to hop into the command line for one reason or another.
I’ll try to write a guide everyday or so for the next week or so.
Drop a follow lmaooo and happy coding with the game jam!