Friday, April 14, 2017

First Trump character created

Today I created the second character of the game, the basic Trump character. It is a guy pushing the border wall, trying to keep the mexicans out. This will be the most basic character of the Trump team. He will cost little, move at an avarage pace and have little health.
Although that could change later. (Maybe we will create a character without a wall to be the basic one and have this a a character with much health.)
Anyway here are some sketches and then the final animation. As you can see the wall is quite heavy for Mr. Trump to push so he is breathing heavely.
First sketches
Final animation

Saturday, April 1, 2017

JavaFX | Make an update of the UI | Platform.runlater

In javaFX any update of the user interface should be done by the javaFX application thread. Any other thread trying to update the UI will crash the application. So if you have a multi threaded application every line of code that update the UI should be wrapped in Platform.runLater block like this:
Platform.runLater(new Runnable() {
    @Override
    public void run() {
        // Update UI here.
    }
});
Or using lambda Expression:
Platform.runLater(
  () -> {
    // Update UI here.
  }
);

Wednesday, March 29, 2017

First game character created

Last weekend I created our first character to play in the game. This is the basic sombrero character that tries to get over the wall. I created it in Adobe Animate, alltough I have never used that programm it didn't take long to learn the basic features. Also it is easy to export it as a sprite sheet, which we will have to use to implement in the game.

First "Sombrero" character animated

First I thought about the design og the hat, because all the sombrero characters will wear a sombrero hat. I had already drawn a hat for the Logo I made so I used that one. You can see the Logo here, alltough I will probably update this Logo and make it better for when the final version of our game comes out.
Logo, probably not the final version

Now back to the process of the first character. I started to think simple and only have a hat with feet. Also to learn the programm better. I came up with this:
First animated character

After that I started drawing some sketches at home. I started by looking at the "zombie" characters from the "Plants vs Zombies" game. I switched his head back, changed his mouth, added some big eyebrows (with a nice little animation) and made his clothes a little more "Mexican style". You can see the comparison below. I should probably make his head a little bigger.
Basic "Sombrero" character
"Plants vs Zombies" character





















As you can see this was quite a process and the next character will be a "Sombrero" on a donkey, in the game he will cost more recources than the basic version, but have more speed.

Saturday, March 25, 2017

JUnit | Adding JUnit Library to IntelliJ IDE

IntelliJ is shipped with JUnit versions but they are not added to your project by default. You have to add JUnit libraries to your project manually. I'll show you how to do it the easy way.
  1. Place the cursor at the end of the class name.
  2. The cursor should be exactly at the end of the class name
  3. Press Alt + Enter
  4. Alt-Enter pressed
  5. Click create test and choose the latest JUnit version. If JUnit is not in the module, press Fix
  6. Fix button shown up
  7. Use the JUnit library that comes with IntelliJ and check all the methods you want to test
  8. choose IntelliJ's JUnit distribution
    check the boxes and press ok!
  9. Go to project structure and set the scope to compile
Remark: It's conventional to have the same test class name as the class tested with the suffix 'test'.

Thursday, March 23, 2017

Off-Topic | Ubuntu | No wifi connection after standby modus

If you're using Ubuntu on Lenovo ThinkPad T430 series, you might have the same problem as me: No internet connection after you've woken up your laptop from standby modus.

I haven't found any better solution yet but this will solve your problem: go to terminal and run this code sudo service network-manager restart please write comments if you have more automated solution for me.

Wednesday, March 22, 2017

Java | The power of Anonymous Class

Overloading a method in an Anonymous class

Client Class
Client Controller JavaFX
As you can see on the pictures above, display method is defined and called in the client class. If we want that any process from the display method to be done in a different class, we can use an anonymous class. The idea is simple. you create an instance of a class that immediately invoked itself and overload all the methods which are defined and called in that class to be done in the target class.