Game
Smacklings
6 years ago

Java, but not Java. What makes Smacklings development awesome?


As mentioned in game's description, the development tool for Smackings is Java. Kind of. It was the closest one to match what is happening here.

It indeed is Java's JVM running Java bytecode (or Dalvik on Android) but the code we write is not Java. The language used to make Smacklings is called Kotlin. Kotlin is a programming language created by JetBrains. You might know the company better from tools like IntelliJ IDEA or a variant of it, Android Studio. Essentially Kotlin is an independent laguage that compiles into Java bytecode an therefore is runnable wherever Java programs are.

"Why?" you might ask. Well, for two seasons. First, Google announced last year that Kotlin is the preferred language for Android development. It is pretty good reason itself but wouldn't write this post just to tell that.

Second reason is that I found Kotlin to be awesome. There are ton on cool features but I won't go through them all here. You can always go and check the official documentation

No forced semicolons! It is a small and simple thing but it makes us happy. You can still use semicolons if you really want and in cases where you really need to. Think about it, how often do you write multiple expressions on same line and need to split them up with semicolon?

Another nifty feature is string interpolation.

Instead of writing "time remaining: " + minutes + ":" + seconds you can write "time remaining: ${minutes}:${seconds}" neat, huh?

Here is another example what Kotlin can do. Code here is from character controller class:

		
			private fun act(dir:Int) {  
  if (!alive) {    
    return  
  }  

  when (state) {    
    CharacterState.IDLING -> jump(dir)    
    CharacterState.JUMPING -> attack(dir)
  }
}
		
	

CharacterState is an enum and state-variable is field of the class. This is kind of Kotlin version of switch-case flow but way cleaner and cooler. That when-expression could easily return a value too but that was not need for this functionality.

We might post more neat stuff from the game's sources so stay tuned for the next one!



1 comment

Loading...

Next up

Smacklings announces here on Game Jolt! Go check our development progress https://gamejolt.com/games/smacklings/477866

Here is a fresh screenshot from two-player mode.

Here is one of the chracters, Dan, being photographed. The small paper roll behind his head was used as a support. After that it was edited in Photoshop and exported to the game as a png file.

Out of boredom and curiosity, I coded Sailor Jupiter's Argentine Backbreaker.

Here's a Fredbear sprite i made in Aseprite! I'm pretty proud of this!

(Btw, sorry for the double post! I'll try to post less)

Hi all, Quick update with a bunch of fixes and changes.

Updated save system, optimisation and screen tear fixes, a new shoutout room and more sounds.

Don't forget to follow the kickstarter going live on the 20th! https://www.kickstarter.com/projects/9fingergames/zapling-bygone

Enjoy!

Development of my game Juno. This is the rune equipment system.

Usually update over on twitter: https://twitter.com/synrec_kaisyl

It's old and it glows. Experience the nostalgic tile-matching puzzle game in it's new glory!

Game : https://gamejolt.com/games/colortris/499578

ColorTris gameplay - Peach squares

______________________

Music : https://soundcloud.com/the-musical-ghost/ghost-kozmos-tetris-the…

Art made for my friend @ungerbibs . Much love for this <3

Let's gooo! Sub-15 minutes achieved thanks to a new skip found by @mazou !

My new Endfall demo Any% world record is 14:48! Used safe strats and got too excited here and there, but I'm satisfied. Thanks to @ElPichon for the game, and y'all beat my time! ;D