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

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.

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.

Did you know that today is #InternationalJazzDay? 🎷😎

No? 😯 Well, we couldn't pass up this date!

And what better to celebrate this day than #Pecaminosa #OST? 🎷

Let us know what you think about it and have a great weekend!

We're glad to announce that Baby Dino Adventures 🦖 is now available in Early Access here on GameJolt! Link: https://gamejolt.com/games/babydinoadventures/508121 Walk, run, and jump as a baby t-rex in this cute platformer Free demo available #IndieGame | #GameDev | #PixelArt

Today I tackled drawing different variations of facial expressions for one of the main characters in Eden. What do you think of it? :) Eden: https://gamejolt.com/games/Eden/592698

Levels' maps.

A few screenshots of the places you'll cross in the Demo of Blu. You can play it today on #gamejolt !

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

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

:] me sigue sin gustar

:] I still don't like it