mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
multiple lightboxes for luminous actors
Former-commit-id: 7ee7d962a9da07d6b1a7936ee19a7458f390bbbc Former-commit-id: c5c83ec33ecaade54a73bcc211318ecd4a473182
This commit is contained in:
@@ -3,6 +3,7 @@ package net.torvald.terrarum.gameactors
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-06-17.
|
||||
@@ -14,7 +15,7 @@ class FixturesTikiTorch : FixturesBase(), Luminous {
|
||||
set(value) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
override val lightBox: Hitbox = Hitbox(3.0, 0.0, 4.0, 3.0)
|
||||
override val lightBoxList: ArrayList<Hitbox>
|
||||
|
||||
init {
|
||||
isVisible = true
|
||||
@@ -22,6 +23,9 @@ class FixturesTikiTorch : FixturesBase(), Luminous {
|
||||
|
||||
setHitboxDimension(10, 24, 0, 0)
|
||||
|
||||
lightBoxList = ArrayList(1)
|
||||
lightBoxList.add(Hitbox(3.0, 0.0, 4.0, 3.0))
|
||||
|
||||
sprite = SpriteAnimation()
|
||||
sprite!!.setDimension(10, 27)
|
||||
sprite!!.setSpriteImage("res/graphics/sprites/fixtures/tiki_torch.png")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-14.
|
||||
*/
|
||||
@@ -20,6 +22,7 @@ interface Luminous {
|
||||
* Arguments:
|
||||
*
|
||||
* Hitbox(x-offset, y-offset, width, height)
|
||||
* (Use ArrayList for normal circumstances)
|
||||
*/
|
||||
val lightBox: Hitbox
|
||||
val lightBoxList: List<Hitbox>
|
||||
}
|
||||
@@ -71,8 +71,8 @@ class Player : ActorWithBody(), Controllable, Pocketed, Factionable, Luminous, L
|
||||
set(value) {
|
||||
actorValue[AVKey.LUMINOSITY] = value
|
||||
}
|
||||
override val lightBox: Hitbox
|
||||
get() = Hitbox(0.0, 0.0, hitbox.width, hitbox.height) // use getter; dimension of the player may change by time.
|
||||
override val lightBoxList: List<Hitbox>
|
||||
get() = arrayOf(Hitbox(0.0, 0.0, hitbox.width, hitbox.height)).toList() // use getter; dimension of the player may change by time.
|
||||
|
||||
companion object {
|
||||
@Transient internal const val ACCEL_MULT_IN_FLIGHT: Double = 0.21
|
||||
|
||||
@@ -174,16 +174,17 @@ object LightmapRenderer {
|
||||
Terrarum.game.actorContainer.forEach { it ->
|
||||
if (it is Luminous && it is Visible) {
|
||||
// put lanterns to the area the luminantBox is occupying
|
||||
val lightBox = it.lightBox
|
||||
val lightBoxX = it.hitbox.posX + lightBox.posX
|
||||
val lightBoxY = it.hitbox.posY + lightBox.posY
|
||||
val lightBoxW = lightBox.width
|
||||
val lightBoxH = lightBox.height
|
||||
for (y in lightBoxY.div(TSIZE).floorInt()
|
||||
..lightBoxY.plus(lightBoxH).div(TSIZE).floorInt())
|
||||
for (x in lightBoxX.div(TSIZE).floorInt()
|
||||
..lightBoxX.plus(lightBoxW).div(TSIZE).floorInt())
|
||||
lanternMap.add(Lantern(x, y, it.luminosity))
|
||||
for (lightBox in it.lightBoxList) {
|
||||
val lightBoxX = it.hitbox.posX + lightBox.posX
|
||||
val lightBoxY = it.hitbox.posY + lightBox.posY
|
||||
val lightBoxW = lightBox.width
|
||||
val lightBoxH = lightBox.height
|
||||
for (y in lightBoxY.div(TSIZE).floorInt()
|
||||
..lightBoxY.plus(lightBoxH).div(TSIZE).floorInt())
|
||||
for (x in lightBoxX.div(TSIZE).floorInt()
|
||||
..lightBoxX.plus(lightBoxW).div(TSIZE).floorInt())
|
||||
lanternMap.add(Lantern(x, y, it.luminosity))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
BIN
work_files/Controls.pdf
Normal file
BIN
work_files/Controls.pdf
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<string>numbers-trunk-20080702_1</string>
|
||||
<string>numbers-trunk-20080731_1</string>
|
||||
<string>numbers-trunk-20080801_2</string>
|
||||
<string>numbers-trunk-20080909_1</string>
|
||||
<string>numbers-trunk-20080911_1</string>
|
||||
<string>numbers-trunk-20080926_1</string>
|
||||
<string>numbers-trunk-20081016_1</string>
|
||||
<string>local build-Oct 16 2012</string>
|
||||
<string>M3.0.1-1483-1</string>
|
||||
</array>
|
||||
</plist>
|
||||
@@ -1 +0,0 @@
|
||||
54874EF4-5D25-4B52-8A3E-84AFFFAC77D3
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 81 KiB |
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user