WIP removing fluid marker block

see "work_files/todo_platforms.png"
This commit is contained in:
Minjae Song
2018-12-29 17:04:46 +09:00
parent abfd9b68fc
commit 2335312081
7 changed files with 42 additions and 40 deletions

View File

@@ -42,7 +42,22 @@ open class FixtureBase(val blockBox: BlockBox) :
}
}
data class BlockBox(val collisionType: Int, val width: Int, val height: Int) {
data class BlockBox(var collisionType: Int, var width: Int, var height: Int) {
fun redefine(collisionType: Int, width: Int, height: Int) {
redefine(collisionType)
redefine(width, height)
}
fun redefine(width: Int, height: Int) {
this.width = width
this.height = height
}
fun redefine(collisionType: Int) {
this.collisionType = collisionType
}
companion object {
const val NO_COLLISION = Block.ACTORBLOCK_NO_COLLISION
const val FULL_COLLISION = Block.ACTORBLOCK_FULL_COLLISION

View File

@@ -4,13 +4,15 @@ import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.ceilInt
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/**
* Created by minjaesong on 2017-01-07.
*/
class TapestryObject(pixmap: Pixmap, val artName: String, val artAuthor: String) : FixtureBase(physics = false) {
class TapestryObject(pixmap: Pixmap, val artName: String, val artAuthor: String) :
FixtureBase(BlockBox(BlockBox.NO_COLLISION, 1, 1)) // placeholder blockbox
{
// physics = false only speeds up for ~2 frames with 50 tapestries
@@ -24,6 +26,9 @@ class TapestryObject(pixmap: Pixmap, val artName: String, val artAuthor: String)
setHitboxDimension(texture.width, texture.height, 0, 0)
setPosition(Terrarum.mouseX, Terrarum.mouseY)
// you CAN'T destroy the image
// redefine blockbox
blockBox.redefine(texture.width.div(TILE_SIZEF).ceilInt(), texture.height.div(TILE_SIZEF).ceilInt())
}
override fun update(delta: Float) {