korlibs / korge

KorGE Game Engine. Multiplatform Kotlin Game Engine
https://korge.org/
Other
2.57k stars 125 forks source link

Provide View.advance function #120

Open soywiz opened 4 years ago

soywiz commented 4 years ago

Maybe something like this:

fun View.advance(amount: Double, rotation: Angle = this.rotation) {
    x += rotation.cosine * amount
    y += rotation.sine * amount
}
RezMike commented 4 years ago

What should it do? What effect do you want to achieve with this function?

soywiz commented 3 years ago

This is intended for example for spaceship games where you want the spaceship to move in the current direction. LEFT & RIGHT keys change the angle property while the UP & DOWN, move forward with the current angle by using that function.

This function was available on DIV Game Studio, Fenix, Bennu etc. : http://wiki.bennugd.org/index.php?title=Xadvance