jcurtis06 / kodot Goto Github PK
View Code? Open in Web Editor NEWJadot, but in Kotlin.
Jadot, but in Kotlin.
With the following code, the player can only move to the right.
override fun update(delta: Double) {
super.update(delta)
if (Input.isKeyPressed(KeyEvent.VK_D)) {
println("D")
velocity.x += 1.0
}
if (Input.isKeyPressed(KeyEvent.VK_A)) {
velocity.x -= 1.0
}
moveAndSlide(Direction.UP)
velocity = Vector2(0.0, 0.0)
}
Currently, there is no ability to add nodes to a scene after the init
of a Node.
This works:
class SceneB: Node(NodeType.NODE, "Scene B") {
init {
name = "Scene B"
val text = Text("Scene B")
text.position.x = 100.0
text.position.y = 100.0
addChild(text)
}
}
But this does not:
class SceneB: Node(NodeType.NODE, "Scene B") {
override fun ready() {
name = "Scene B"
val text = Text("Scene B")
text.position.x = 100.0
text.position.y = 100.0
addChild(text)
println("Scene B ready")
}
}
The Problem
A scenes deeply iterated children are only added when the scene is updated:
fun changeScene(newScene: Node) {
// snippet
nodes.addAll(currentScene.deepChildren)
nodes.add(newScene)
}
The Solution
We need to check if the current scenes deep children has changed in the update()
method in Kodot.kt
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.