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 *.iml
*.log *.log
.DS_Store .DS_Store
/sample-pong/build/

View File

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

View File

@@ -30,7 +30,7 @@ suspend fun main() = Korge(
spawnAsteroid(WIDTH - 20.0, 20.0) spawnAsteroid(WIDTH - 20.0, 20.0)
ship.onCollision(kind = CollisionKind.SHAPE) { ship.onCollision {
if (it is Asteroid) { if (it is Asteroid) {
//ship.removeFromParent() //ship.removeFromParent()
println("GAME OVER!") println("GAME OVER!")
@@ -44,7 +44,7 @@ suspend fun main() = Korge(
asteroid.x = random[0.0, WIDTH.toDouble()] asteroid.x = random[0.0, WIDTH.toDouble()]
asteroid.y = random[0.0, HEIGHT.toDouble()] asteroid.y = random[0.0, HEIGHT.toDouble()]
asteroid.angle = random[0.0, 360.0].degrees 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 var bulletReload = 0.0
@@ -65,7 +65,7 @@ suspend fun main() = Korge(
.rotation(ship.rotation) .rotation(ship.rotation)
.advance(assets.shipSize * 0.75) .advance(assets.shipSize * 0.75)
bullet.onCollision(kind = CollisionKind.SHAPE) { bullet.onCollision {
if (it is Asteroid) { if (it is Asteroid) {
bullet.removeFromParent() bullet.removeFromParent()
it.divide() it.divide()
@@ -104,13 +104,13 @@ class Asteroid(val assets: Assets, val asteroidSize: Int = 3) : Image(assets.ast
val scale = time / 16.milliseconds val scale = time / 16.milliseconds
val dx = angle.cosine * scale val dx = angle.cosine * scale
val dy = angle.sine * scale val dy = angle.sine * scale
//x += dx x += dx
//y += dy y += dy
if (y < 0 && dy < 0) angle += 45.degrees if (y < 0 && dy < 0) angle += 45.degrees
if (x < 0 && dx < 0) angle += 45.degrees if (x < 0 && dx < 0) angle += 45.degrees
if (x > WIDTH && dx > 0) angle += 45.degrees if (x > WIDTH && dx > 0) angle += 45.degrees
if (y > HEIGHT && dy > 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.*
import com.soywiz.korge.atlas.readAtlas import com.soywiz.korge.atlas.*
import com.soywiz.korge.view.Stage import com.soywiz.korge.view.*
import com.soywiz.korge.view.image import com.soywiz.korio.*
import com.soywiz.korge.view.position import com.soywiz.korio.dynamic.*
import com.soywiz.korio.file.std.resourcesVfs import com.soywiz.korio.file.std.*
suspend fun main() = Korge(width = 640, height = 480, virtualWidth = 320, virtualHeight = 240) { suspend fun main() = Korge(width = 640, height = 480, virtualWidth = 320, virtualHeight = 240) {
atlasMain() atlasMain()
} }
suspend fun Stage.atlasMain() { suspend fun Stage.atlasMain() {
val logos = resourcesVfs["logos.atlas.json"].readAtlas() val logos = resourcesVfs["logos.atlas.json"].readAtlas(views)
image(logos["korau.png"]).position(0, 0) image(logos["korau.png"].texture).position(0, 0)
image(logos["korim.png"]).position(64, 32) image(logos["korim.png"].texture).position(64, 32)
image(logos["korge.png"]).position(128, 64) image(logos["korge.png"].texture).position(128, 64)
} }

View File

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

View File

@@ -7,19 +7,19 @@ import com.soywiz.korio.async.*
import com.soywiz.korio.file.std.* import com.soywiz.korio.file.std.*
suspend fun main() = Korge { suspend fun main() = Korge {
val atlas = resourcesVfs["lips.atlas.json"].readAtlas() val atlas = resourcesVfs["lips.atlas.json"].readAtlas(views)
val lips = image(atlas["lisa-A.png"]) val lips = image(atlas["lisa-A.png"].texture)
val lips2 = image(atlas["lisa-A.png"]).position(400, 0) val lips2 = image(atlas["lisa-A.png"].texture).position(400, 0)
addEventListener<LipSyncEvent> { addEventListener<LipSyncEvent> {
println(it) println(it)
if (it.name == "lisa") { if (it.name == "lisa") {
lips2.texture = atlas["lisa-${it.lip}.png"] lips2.texture = atlas["lisa-${it.lip}.png"].texture
} }
} }
launchImmediately { launchImmediately {
fun handler(it: LipSyncEvent) { fun handler(it: LipSyncEvent) {
views.dispatch(it) 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) } 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.*
import com.soywiz.korge.time.* import com.soywiz.korge.time.*
import com.soywiz.korge.view.addFixedUpdater
import com.soywiz.korge.view.tiles.* import com.soywiz.korge.view.tiles.*
import com.soywiz.korim.bitmap.* import com.soywiz.korim.bitmap.*
import com.soywiz.korim.format.* import com.soywiz.korim.format.*
@@ -11,9 +9,12 @@ import com.soywiz.korio.file.std.*
suspend fun main() = Korge(width = 512, height = 512) { 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 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) val tilemap = tileMap(Bitmap32(1, 1), repeatX = TileMap.Repeat.REPEAT, repeatY = TileMap.Repeat.REPEAT, tileset = tileset)
addFixedUpdater(60.timesPerSecond) { launchImmediately {
tilemap.x += 1 while (true) {
tilemap.y += 0.25 tilemap.x += 1
tilemap.y += 0.25
delayFrame()
}
} }
} }