Why are there Duplicate Methods in the Beginner Tutorial?


#1

Hello!

I just started out on the beginner tutorial:

https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_simpleapplication.html

Having completed it, I would to know why the method that sets up the the blue cube walk-through is duplicated. It appears in Main and in HelloJME3. Did I do something wrong? I feel I can’t proceed until I understand this.

Many thanks in advance.
Jason


#2

Ummm. I’m not seeing what your’e talking about.

Cut and paste what you are seeing into a reply.


#3

My guess… is that it tells him to create a simple game project which will already have its own Main class. The tutorial doesn’t tell you to delete the one that comes with the default project. Most people would know to do this automatically but very new developers won’t know this, I guess.


#4

I see. Il clean it up.


#5

Hi

Thanks for your replies and patience. In the very first tutorial, “Create a project” I complete these first steps:

1. Choose File→New Project… from the main menu.

2. In the New Project wizard, select the template JME3→Basic Game. Click Next.

3. Specify a project name, e.g. “HelloWorldTutorial

4. Specify a path where to store your new project, e.g. a jMonkeyProjects directory in your home directory.

5. Click Finish.

After that, the IDE shows the source code of the package mygame, and the class public class Main extends SimpleApplication {}

In that class is a method called public void simpleInitApp() which contains a few lines of code to set up the blue cube walkthrough:

After that the next tutorial is “Extend SimpleApplication”:

  1. In the jMonkeyEngine SDK:

  2. Right-click the Source Packages node of your project.

  3. Choose New…→Java Class to create a new file.

  4. Enter the class name: HelloJME3

  5. Enter the package name: jme3test.helloworld.

  6. Click Finish.

The SDK creates the file HelloJME3.java for you.

There is then a code sample to paste in which is in essence identical to the Main class mentioned above, but this package is called jme3test.helloworld with a class is called HelloJME3.

So when I get there, I have two different packages with the same content. I understand now (from pspeed) we are supposed to delete mygame (or replace the code in it). So I guess I was just confused by the approach because when I hit the run button in the editor, it was executing the Main class, not the HelloJM3. That meant changes I made to the scene parameters didn’t show.

Incidently, it did leave me wondering how one can set the main class when the are two classes with main methods…


#6

In the project settings.

Any time you have to set something like that about the project it is likely in the project settings.


#7

Try it now.
https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_simpleapplication.html


#8

Thanks very much for that, and also for your great work with tutorials in general!