Error with the "Hello World" tutorial.

  • Hello, I've been unable to get the Hello World tutorial to work on my PC (Windows 10.)

    As far as I know I've installed everything correctly, but for some reason it doesn't work.

    Firstly it doesn't create the template in its chosen location (Which is for some reason C:\Windows\system32\HelloWorld), and then gets the error of "'code' is not recognized as an internal or external command, operable program or batch file."

    Any idea what the error is? I'd really like to use Flixel.

    (And yes, I've tried moving past this, but everything that I compile in FlashDevelop only shows a black screen, or some other weird error like the "Main" module not being defined or something like that.)

    Thank you in advance.

  • @vulpicula said in Error with the "Hello World" tutorial.:

    is not recognized as an internal or external command, operable program or batch file."

    This sounds like a path issue. What does echo %HAXEPATH% return?

  • Inputting "echo %HAXEPATH%" into the CMD results in the output of "C:\HaxeToolkit\haxe"

    Did I install it in the wrong location?

  • @vulpicula
    %HAXEPATH% looks fine.

    haxelib list in CMD and post your list. Maybe your openfl or lime version is wrong, or you're missing something.

    Also, enter haxe in CMD to check the version. I could be wrong, but I think I read somewhere that the latest version 3.4.2 doesn't work. I'm still using 3.2.0 which works but I probably can upgrade.

  • @dean

    I am using Haxe 3.4.2, which could be the problem.

    Also, inputting haxelib list results in the following output:

    flixel-addons: [2.5.0]
    flixel-demos: [2.4.1]
    flixel-templates: [2.4.4]
    flixel-tools: [1.4.0]
    flixel-ui: [2.2.0]
    flixel: [4.3.0]
    hxcpp: [3.4.64]
    lime-samples: [4.0.1]
    lime: [2.9.1]
    nme: [5.7.1]
    openfl: [3.6.1]

  • @vulpicula

    I'm not 100% sure about the haxe version. Maybe someone that knows will chime in.

    I not sure of hxcpp either. I'm using hxcpp: [3.3.49]

    You definitely shouldn't be creating your project in C:\Windows\system32. You should move to the dir you want the project created then enter flixel tpl -n "HelloWorld"

  • hmm. I tried creating the project and had the same problems you had, except for the folder it created in. I got a black screen. I looked at the code generated and it's an empty template.

    Sorry, I don't know what's up with that.

  • ok, you have to add the text yourself. Guess I should have read the tutorial :P

    All you need to do is add the following three lines to the create() >function (and save the file):

    var text = new flixel.text.FlxText(0, 0, 0, "Hello World", 64);

    This will create a new FlxText instance with font size 64, center it on the > screen and add() it so it is displayed.

    flixel tpl -n "HelloWorld" just creates a blank template.

  • How exactly would I change the directory of where the project generates? It's always done it to System32 by default, so I've been unable to do anything in regards to it.

    I've also already added said text (Via creating a new project using FlashDevelop, and copying everything over), but that still results in a black screen. Perhaps changing to an older version of Haxel will fix it?

  • @vulpicula

    C:\Users\Dean\ is where my CMD window starts out when entering cmd in the search programs from the Start button on Window 7. If you're in system32 when opening CMD, you can cd C:\Users\YourName to get to your user folder. and cd SomeSubFolder

    I'm really not sure about the haxe version.

    You said something about Main module not found. Do you have Main.hx?

    It should have created:

    	assets/ (with empty subfolders not being used)

  • @dean Yeah, even when setting it to a file in my documents folder, it still has the error of "'code' is not recognized as an internal or external command, operable program or batch file."

    And yes, I do have a Main.hx, which is located in the source file.

  • @dean You know what, dean, I think the problem is me taking an impact to the head a few years ago. Literally checked the tutorial and missed a key detail. Goes in PlayState.hx, instead of Main.hx (I'm used to C++ and Java, which allows me to put large amounts in the Main class.) (...and for some reason those two files didn't generate anyways. :s)

    While it doesn't answer the weird error of 'code' not being recognized, it does work now.

    (Oddly enough, some of the demos are non-functional, with errors such as "source/PlayState.hx:3: characters 7-41 : Type not found : flixel.addons.ui.FlxUIButton", and "source/Main.hx:6: lines 6-13 : Defined in this class")

  • @vulpicula

    At least you got it working. If it helps, you can download all the demos from github and they all have the flashdevelop.hxproj file.
    and you should be able to open the .hxproj file.

  • administrators

    @vulpicula Don't worry about the 'code' not being recognized error. That's flixel-tools trying to launch Visual Studio Code via the code command after creating the template. You can tell flixel-tools which IDE to use during setup (run flixel setup). There also won't be a FlashDevelop .hxproj file if you have the default configuration (which defaults to VSCode).

  • administrators

    @vulpicula I just released flixel-tools 1.4.1 on haxelib, which adds some output that should make it more obvious what flixel-tools is doing when running template or create commands. :)

  • Odd. Even after setting it to use FlashDevelop via the setup, it still insists on running it for Visual Studio Code. (Or more specifically, it defaults to that every time I restart the CMD.)

  • This post is deleted!

  • Aside from that, everything seems to be working. Thank you so much. ^^

    Also, on the "Groundwork" tutorial, I think you forgot to mention that you need to add 'import flixel.FlxG;"
    I know it's supposed to do it automatically, but for some reason it's not doing that on my PC.

    I do have a few other questions, but they're mainly just "How do I do this?" rather than something not working.

  • @vulpicula

    This cheat-sheet has a few examples of common things.

    I found it helpful to check out the demos and try things with the code to see how things work.

  • @dean I've been doing that so far. A bit of splicing code in and out as well has helped a ton. I don't quite understand some of the code behind it, but I'm starting to understand what does what.

    Only question I'm struggling with, is "How do I add a text field so the user can type something in, that then gets saved to a string?"

Log in to reply

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