Download Eclipse SimRel 2018-09 edition then create a new blank scene with JavaFx in Windows 10

It has been a while since I have stopped developing game for windows 10 and android phone but starting from today I have decided to get really busy and spend most of my time writing articles as well as develop a few new games and applications at the same time for android phone as well as windows 10. Do follow this blog as well as my other blog codingdirectional.info to read all the brand new game and application development articles starting from today (November 5 2018) onward.

Here are what I have in mind for my new game development projects:

1) Develop 1 to 5 laptop games with JavaFx.
2) Develop 1 to 5 laptop games with pygame (a python framework for game development).
3) Develop 1 to 5 android games using Unity, AndEngine as well as purely Java code.

So there it is, it will be a very busy working days to me starting from today.

This article will become the starting point for one of the five games that I will create using JavaFx, if you want to follow the development of this new JavaFx game then don’t forget to follow the game development article in the JavaFx category of this website. The game which creates with pygame will be put under the Pygame category which you can also read it on this same website.

Ok, without wasting any time lets get started with our new JavaFx game development. Here are the things we need before we can start writing the JavaFx game.

1) I will use Java version 8 instead of 11 because Java 8 is the most stable version of Java at this moment. So you will need to go ahead and download the Java SE Development Kit 8u192 (includes JRE) if you have not yet installed one in your windows os already. After you have downloaded the JDK packages go ahead and follow the step by step set up instructions to install Java SDK on the windows os and we will then be ready for step number two.

2) The are lots of great tools that we can use to write a Java program but my best favorite is always Eclipse because I am the fan of Eclipse since I was a young man and until now Eclipse is still my best choice when it comes to picking an IDE for game development. So go ahead and Download Eclipse SimRel 2018-09 edition installer then start to download and install the Eclipse IDE for Java Developers to your Windows 10 OS.

Eclipse Installer
Eclipse Installer

3) After you have installed this latest version of Eclipse just go ahead and launch it, make sure you have have specified the location where to save your projects folder at the first time of your launch.

4) You will be greeted with the welcome screen after you have successfully launched the new Eclipse SimRel 2018-09, click ‘x’ at the top left of the welcome scene to exit it. We need one last step before we can use JavaFx to create a game, we need to install the JavaFX Tooling and Runtime for Eclipse and OSGi software, so go ahead and click on the Help menu then select Install New Software, then on the new pop up click on the Add button to create a new repository, give it a name under the Name field and enter this url http://download.eclipse.org/efxclipse/updates-released/3.3.0/site/ into the Location field and wait for Eclipse to download that Software. You will need to restart Eclipse once the software package has been installed.

5) After you have restarted Eclipse it is time to create a new JavaFx Project, go to the File menu then select New->Project->JavaFx->JavaFx Project then click on the Next button.

JavaFx Project
JavaFx Project

Next fill in the project name then click on the Finish button.

JavaFx Project
Create JavaFx Project

6) Now the java project has been created with a blank ui scene. Look at the file explorer panel of the Eclipse IDE and you should have seen the following file’s structure at the moment.

Click on Main.java file
Click on Main.java file

Select the Main.java file and you will see this file content on the coding panel.

package application;
	
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;


public class Main extends Application {
	@Override
	public void start(Stage primaryStage) {
		try {
			BorderPane root = new BorderPane();
			Scene scene = new Scene(root,400,400);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		launch(args);
	}
}

Click the green arrow button at the top of Eclipse to run the project. If everything goes smoothly then you will see below scene pop up.

Empty JavaFx scene
Empty JavaFx scene

Next look at the file explorer again, do you notice there is a css file inside the application folder? This is where you can set style for the ui. Do you notice this line of code at the above program?

scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());

This means that the scene and all the nodes under that scene will use that same style sheet above.

Now lets modified the above program a little. First we will reset the size of the window, make it non resizable and change the title of that window. Add in or change the code under the start function as follows.

primaryStage.setTitle("Hello World!");
primaryStage.setResizable(false);

Scene scene = new Scene(root,600,600);

Next we will add in a button at the center of the BorderPane’s node, add in an event listener to that button which will terminate the program and close the ui if we click on the button.

Button btn = new Button();
btn.setText("Close");
btn.setOnAction(new EventHandler<ActionEvent>() {
		        @Override public void handle(ActionEvent e) {
			    	System.out.print("close");
			        System.exit(0);
		}});
root.setCenter(btn);

Next lets open the application.css file then set the style for the ui background as well as the button. There is no different between JavaFx css property as compared with the normal one except we will need to prefix it with -fx-. Here is the content of the entire style sheet which you can easily figure it out what is it doing.

* {
    -fx-background-color: #000000;
}

.button {
    -fx-pref-width: 300pt;
    -fx-pref-height:60pt;
    -fx-text-fill: #ffffff;
    -fx-font-family: "Verdana";
    -fx-font-size: 36pt ;
    -fx-background-color: #008000;
    -fx-border-color: #ffffff;
    -fx-border-radius: 10;
    -fx-background-radius: 5;
    -fx-padding: 5;
}

In order for the button to use the button class in the above style sheet you will need this line of code under the start function.

btn.getStyleClass().add("button");

Here are the revise version of the code.

package application;
	
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;


public class Main extends Application {
	
	@Override
	public void start(Stage primaryStage) {
		try {
			primaryStage.setTitle("Hello World!");
			primaryStage.setResizable(false);
			Button btn = new Button();
			btn.setText("Close");
			btn.setOnAction(new EventHandler<ActionEvent>() {
			    @Override public void handle(ActionEvent e) {
			    	System.out.print("close");
			        System.exit(0);
			}});
			btn.getStyleClass().add("button");
			BorderPane root = new BorderPane();
			root.setCenter(btn);
			Scene scene = new Scene(root,600,600);
			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		launch(args);
	}
}
The new window ui
The new window ui

Besides clicking on the button you can also press the ‘x’ button on the top of the pop up window to terminate the program.

With that we have finished the first chapter of the JavaFx game development article and get ready for the second one.

What we have learned from this article.

1) Setting up SimRel 2018-09 edition.
2) Install e(fx)clipse.
3) Run the program.

It will be a very busy day for me as I am now getting ready to develop my new game scene for this new game.

The picture of two snails

There are lots of snails in the place where I live and today I have decided to take a few pictures of those snails after I have seen a big and a small snail climbing on the concrete wall of my backyard.

This first picture was taken while those two snails are climbing up a concrete wall.

Two snails climbing up a wall
Two snails climbing up a wall

The second pictures show the same snails climbing up a tree trunk.

Two snails climb tree
Two snails climb tree

The last photo shows the snails have reached the top of the concrete wall.

Snails climb concrete wall
Snails climb concrete wall

Snails can be found after the rain, if it is a hot day then you won’t find any snail because snail is afraid of hot environment.

Live in a wild nature

I am a full time software and game developer now and my part time job is selling shoes. A few years ago I had moved to this new home which is very far away from the city, the life in this new place is so calm and quiet and the air is free from pollution, we can smell the smell of fresh air everywhere everyday because there is no factory around this area.

Every night you can clearly hear the sound of the insects and frogs around your home.

Every morning I like to take a short walk at the backyard of my home, the grass is green, the tree is green and the sky is always blue.

In such a wonderful environment a person will feel so good and thus really will help me to write better code. Yes with such an environment I really feel like I can write code better than before. Besides coding I am also creating music, these environment really helps me to write happy and joyful music.

We can never imagine there is such a place on earth, it is like a jungle with lots of trees and wild animals.

We have a few cats and sometime they are really naughty…

Sometime I will do some gardening job at my home backyard or cut down some trees.

But most of the time I just write code and enjoy the sunshine.

This place is really great and with that I would like to conclude this article and get back to work!

Rock Quest

In Rock Quest you move the gaming character with left, right, up and down key to collect rock, you need to compete with the robot and do not let that robot collects more than a certain amount of rocks than you do or else it will be game over. Besides that you will also need to avoid getting hit by the monster. This game will be updated constantly so do visit this website to get the latest information.

More levels will be included from time to time so stay tune!

MightBeIt!

MightBeIt is a simple truck game creates with the javascript version of box2d framework. It is now an offline game and will remain offline unless there are some major changes in the future.

If you have any suggestion regarding this game, submit it through the above twitter tweet!

SkyBased

SkyBased is a fun game where you will use left, right, up and down key on the keyboard to move the spaceship around the canvas and use the spacebar to shoot missile at your enemy. This various levels game will continue getting develop by me and you will get notified on every update through this page. Do enjoy playing this offline game and if you have any suggestion do let me know.

The day and night time picture’s quality of Sony DSC W830 camera

Recently I have bought a new sony dsc w830 camera and I have taken a few photos that I would like to show them in this post. Overall speaking I am quite satisfy with the quality of the picture taken by this camera. This camera is great for a beginner or a intermediate photographer like myself, although the default camera response speed is a little bit slow but we can manually adjust it’s speed if we really need to do so.

I have taken two pictures with Sony DSC W830 just with the automatic mode during the day and night time.

The first picture has been taken during the night in the area with very little light and as you can see the quality of the image is very good which we can clearly see the cat sleeping on the cardboard. When I was taking that picture my hand was a little bit shaky and the cat is also moving around a little bit but as you can see the cat inside that picture does not appear to look shaky at all.

Sony W830 Quality
Sony W830 Quality

Here is another picture taking during the day with that same sony camera.

Sony DSC W830 Photo Quality Day Time
Sony DSC W830 Photo Quality Day Time

This sony 20.1 MB camera certainly helps me to take great pictures, the above photos are taken with the automatic mode of this camera and it also seems like there is not many setting we can do with this camera, this camera is certainly a great camera for the starter as well as the intermediate photographer like me. The best part about this camera is it’s ISO range 80-3200 which is probably the best deal we can get when compared with the same category camera in the market place. I am thinking about buying another camera in the future, probably canon ixus 190 but for now I just want to keep on exploring the cool features of this sony dsc w830 camera.

Danish Gambit Chess Game Total Analysis

When it comes to chess, it has became a fact that Danish Gambit is not in any sort of consideration from the chess master to use it against his opponent who has a higher ranking than he does. But for me I really like the style of this gambit which emphasizes on scarifies everything to achieve the victory. I have used this gambit again and again in my chess game against the player with a lot more higher ranking than myself and did achieved great result from it. After a few months of analysis every possible moves from the chess opponent who plays against this gambit I have came out with various solutions ranging from Danish Gambit accepted to Danish Gambit declined and below is one of the game which I have played against a chess opponent using the Danish Gambit in a online chess site. He declines the gambit so the game will follow the Danish Gambit declined procedure accordingly and I did managed to win that game!

I have been doing the Danish Gambit analysis for a while already and so far I have found out various solutions to deal with my opponent who either declines or accepts the gambit on the left handside of the chess board, my next analysis will expend the gambit to the right handdside of the chess board which means to move my queen to the right and attacks the opponent right flange which I believe will be a lot more powerful than just concentrate both the white queen and bishop on the left flange to prepare to take the F-7 pawn on the black queen site. Danish Gambit is a great gambit but we do need to understand the method to defend our king because by using this gambit our king has been exposed to really danger situation when the opponent brings out his queen and prepares to attack!

Create browser game without knowing any programming languages

If you want to create a browser game and put it on your own website for others to enjoy but you do not know any web programming languages such as javascript, php or html5 then you will really love GDevelop which is a game development software that will help yourself to create game without even requires you to write a single line of code.

Game development with GDevelop is very fast
Game development with GDevelop is very fast

I have downloaded GDevelop which itself is an open source software and then create my first game with it, all I have to say is that I really like it!

Normally a game developer needs to write code to detect whether a character has landed on a platform or not, but with GDevelop he does not need to do this anymore because he can simply create that detection logic in just a few steps!

Has the players landed on a platform?
Has a player already landed on a platform?

A game developer also does not need to write his own animation loop for a group of game images any more because with just a few simple settings that take only 1 minute or less the animation loop will be fully ready! I still remember it took me around an hour to write the first animation loop for my first game a few years ago.

This is how to set up the animation loop in GDevelop
This is how you set up the animation loop in GDevelop

You can add as many platforms as you need and as many game characters as you wish and as many character-platform relationships that you wish to have using GDevelop’s set up portal.

Character-Platform relationship
Character-Platform relationship

Once you have created your browser game, pack it up and you are ready to put it on your own website for people to enjoy.

Overall speaking GDevelop is a great piece of browser game development software which will help you to create game without needs you to write a single line of game code. If you have not yet downloaded this IDE then go ahead and download it, you will really love this game creation software once you have installed it on your pc 🙂

That is all, if there is time for more stories then I will write an article about creating a full browser game with GDevelop so don’t miss it if you would!

Create a simple JavaFx program with an empty scene

This article will be a warm-up for a new JavaFx game project tutorial, which I will create and share on this blog. What we will create in this article is a simple blank game scene using the JavaFx library. If you already have the Java 8 SDK installed on your computer, you will also install the JavaFx library.

The following ui program is a simple program uses to display the blank scene of JavaFx.

package info.codingdirectional;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class JavaFxExample extends Application {
	
	private double CANVAS_WIDTH = 300;
	private double CANVAS_HEIGHT = 300;

	@Override
	public void start(Stage stage) throws Exception {
		StackPane root = new StackPane();
		Scene theScene = new Scene( root, CANVAS_WIDTH, CANVAS_HEIGHT);
		stage.setScene(theScene);
		stage.setTitle( "Empty Game Scene" );
		stage.show();
	}
	
	public static void main(String[] args) {
		Application.launch(args);
	}

}

The width and height of the scene are both 300.

Empty Scene
Empty Scene