Revert "KorGE 1.13.0.0"

This reverts commit e8319ed714.
This commit is contained in:
soywiz
2020-06-08 10:02:51 +02:00
parent e8319ed714
commit 3e5beb9bc4
7 changed files with 36 additions and 37 deletions

1
.gitignore vendored
View File

@@ -10,4 +10,3 @@ game.storage
*.iml
*.log
.DS_Store
/sample-pong/build/

View File

@@ -1,5 +1,4 @@
korgePluginVersion=1.13.0.0
#korgeVersion=1.13.0-SNAPSHOT
korgePluginVersion=1.12.8.0
#korgeVersion=1.12.8-SNAPSHOT
#korimVersion=1.12.15
#korimVersion=1.12.11-SNAPSHOT

View File

@@ -30,7 +30,7 @@ suspend fun main() = Korge(
spawnAsteroid(WIDTH - 20.0, 20.0)
ship.onCollision(kind = CollisionKind.SHAPE) {
ship.onCollision {
if (it is Asteroid) {
//ship.removeFromParent()
println("GAME OVER!")
@@ -44,7 +44,7 @@ suspend fun main() = Korge(
asteroid.x = random[0.0, WIDTH.toDouble()]
asteroid.y = random[0.0, HEIGHT.toDouble()]
asteroid.angle = random[0.0, 360.0].degrees
} while (ship.distanceTo(asteroid) < 100.0)
} while (asteroid.collidesWith(ship) || ship.distanceTo(asteroid) < 100.0)
}
var bulletReload = 0.0
@@ -65,7 +65,7 @@ suspend fun main() = Korge(
.rotation(ship.rotation)
.advance(assets.shipSize * 0.75)
bullet.onCollision(kind = CollisionKind.SHAPE) {
bullet.onCollision {
if (it is Asteroid) {
bullet.removeFromParent()
it.divide()
@@ -104,13 +104,13 @@ class Asteroid(val assets: Assets, val asteroidSize: Int = 3) : Image(assets.ast
val scale = time / 16.milliseconds
val dx = angle.cosine * scale
val dy = angle.sine * scale
//x += dx
//y += dy
x += dx
y += dy
if (y < 0 && dy < 0) angle += 45.degrees
if (x < 0 && dx < 0) angle += 45.degrees
if (x > WIDTH && dx > 0) angle += 45.degrees
if (y > HEIGHT && dy > 0) angle += 45.degrees
//rotationDegrees += scale
rotationDegrees += scale
}
}

View File

@@ -1,17 +1,17 @@
import com.soywiz.korge.Korge
import com.soywiz.korge.atlas.readAtlas
import com.soywiz.korge.view.Stage
import com.soywiz.korge.view.image
import com.soywiz.korge.view.position
import com.soywiz.korio.file.std.resourcesVfs
import com.soywiz.korge.*
import com.soywiz.korge.atlas.*
import com.soywiz.korge.view.*
import com.soywiz.korio.*
import com.soywiz.korio.dynamic.*
import com.soywiz.korio.file.std.*
suspend fun main() = Korge(width = 640, height = 480, virtualWidth = 320, virtualHeight = 240) {
atlasMain()
}
suspend fun Stage.atlasMain() {
val logos = resourcesVfs["logos.atlas.json"].readAtlas()
image(logos["korau.png"]).position(0, 0)
image(logos["korim.png"]).position(64, 32)
image(logos["korge.png"]).position(128, 64)
val logos = resourcesVfs["logos.atlas.json"].readAtlas(views)
image(logos["korau.png"].texture).position(0, 0)
image(logos["korim.png"].texture).position(64, 32)
image(logos["korge.png"].texture).position(128, 64)
}

View File

@@ -25,14 +25,14 @@ suspend fun main() = Korge {
val gamepadUpdateText = textLine("GamepadUpdateEv")
val gamepadUpdate2Text = textLine("GamepadUpdate2Ev")
stage.addEventListener<KeyEvent> { keysEvText.text = "${nowUnix()}:$it" }
stage.addEventListener<MouseEvent> { mouseEvText.text = "${nowUnix()}:$it" }
stage.addEventListener<ReshapeEvent> { resizeText.text = "${nowUnix()}:$it" }
stage.addEventListener<GamePadConnectionEvent> { gamepadConnectedText.text = "${nowUnix()}:$it" }
stage.addEventListener<GamePadUpdateEvent> {
gamepadUpdateText.text = "${nowUnix()}:$it"
gamepadUpdate2Text.text = "" + it.gamepads.lastOrNull { it.connected }?.rawButtonsPressed
}
//stage.addEventListener<KeyEvent> { keysEvText.text = "${nowUnix()}:$it" }
//stage.addEventListener<MouseEvent> { mouseEvText.text = "${nowUnix()}:$it" }
//stage.addEventListener<ReshapeEvent> { resizeText.text = "${nowUnix()}:$it" }
//stage.addEventListener<GamePadConnectionEvent> { gamepadConnectedText.text = "${nowUnix()}:$it" }
//stage.addEventListener<GamePadUpdateEvent> {
// gamepadUpdateText.text = "${nowUnix()}:$it"
// gamepadUpdate2Text.text = "" + it.gamepads.lastOrNull { it.connected }?.rawButtonsPressed
//}
gamepad {
button.invoke { gamepadButtonText.text = "$it" }

View File

@@ -7,19 +7,19 @@ import com.soywiz.korio.async.*
import com.soywiz.korio.file.std.*
suspend fun main() = Korge {
val atlas = resourcesVfs["lips.atlas.json"].readAtlas()
val lips = image(atlas["lisa-A.png"])
val lips2 = image(atlas["lisa-A.png"]).position(400, 0)
val atlas = resourcesVfs["lips.atlas.json"].readAtlas(views)
val lips = image(atlas["lisa-A.png"].texture)
val lips2 = image(atlas["lisa-A.png"].texture).position(400, 0)
addEventListener<LipSyncEvent> {
println(it)
if (it.name == "lisa") {
lips2.texture = atlas["lisa-${it.lip}.png"]
lips2.texture = atlas["lisa-${it.lip}.png"].texture
}
}
launchImmediately {
fun handler(it: LipSyncEvent) {
views.dispatch(it)
lips.texture = atlas["lisa-${it.lip}.png"]
lips.texture = atlas["lisa-${it.lip}.png"].texture
}
resourcesVfs["001.voice.wav"].readVoice().play("lisa") { handler(it) }

View File

@@ -1,7 +1,5 @@
import com.soywiz.klock.timesPerSecond
import com.soywiz.korge.*
import com.soywiz.korge.time.*
import com.soywiz.korge.view.addFixedUpdater
import com.soywiz.korge.view.tiles.*
import com.soywiz.korim.bitmap.*
import com.soywiz.korim.format.*
@@ -11,9 +9,12 @@ import com.soywiz.korio.file.std.*
suspend fun main() = Korge(width = 512, height = 512) {
val tileset = TileSet(mapOf(0 to bitmap("korge.png").toBMP32().scaleLinear(0.5, 0.5).slice()))
val tilemap = tileMap(Bitmap32(1, 1), repeatX = TileMap.Repeat.REPEAT, repeatY = TileMap.Repeat.REPEAT, tileset = tileset)
addFixedUpdater(60.timesPerSecond) {
tilemap.x += 1
tilemap.y += 0.25
launchImmediately {
while (true) {
tilemap.x += 1
tilemap.y += 0.25
delayFrame()
}
}
}