Game
Smacklings
4 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.

We made a lot of improvements on the Freezing Plains visual. Things like pine trees, tiny bushes, some rocks, and others game props!

#IndieGame | #IndieDev | #GameDev | #PixelArt | #WaifuQuest | #WifeQuest | #screenshotsaturday

Runestones: from concept to in-game model🗿

I was bored, so... ManutKat.

Strange Umbrella

Alone Together....

brung back my old oc plus a new one

...they don`t have names yet tho