spawning of dropped item

This commit is contained in:
minjaesong
2021-08-06 21:43:50 +09:00
parent edc3d53f4e
commit ecce123299
9 changed files with 140 additions and 90 deletions

View File

@@ -49,7 +49,7 @@ open class ActorWithBody(renderOrder: RenderOrder, val physProp: PhysProperties)
/** This is GameWorld? only because the title screen also uses this thing as its camera;
* titlescreen does not use instance of Ingame.
*/
private val world: GameWorld?
protected val world: GameWorld?
get() = Terrarum.ingame?.world

View File

@@ -33,8 +33,6 @@ class WireActor(id: ActorID) : ActorWithBody(RenderOrder.WIRES, PhysProperties.I
private var worldX = 0
private var worldY = 0
private val world: GameWorld
get() = Terrarum.ingame!!.world
/**
* @param itemID must start with "wire@"
@@ -58,7 +56,7 @@ class WireActor(id: ActorID) : ActorWithBody(RenderOrder.WIRES, PhysProperties.I
sprite!!.currentRow = 0
val nearbyTiles = getNearbyTilesPos(worldX, worldY).map { world.getAllWiresFrom(it.x, it.y) }
val nearbyTiles = getNearbyTilesPos(worldX, worldY).map { world!!.getAllWiresFrom(it.x, it.y) }
var ret = 0
for (i in 0..3) {
if (nearbyTiles[i]?.contains(itemID) == true) {