Prototype extension methods for RoomVisual
object in screeps. Including structures, road
connections, speech, resource icons, and even animated position markers.
Place a copy of the RoomVisual.js
file from this repository in your project's directory. ie. path/to/RoomVisual.js
Require the downloaded file before your main loop.
require('./path/to/RoomVisual')
Draws structureType
at x
, y
.
// .structure(x, y, structureType)
room.visual.structure(8, 13, STRUCTURE_TOWER)
Connects roads drawn with the above .structure()
the same way the game would.
// .connectRoads()
room.visual.connectRoads()
Simulates creep.say()
through room visuals.
// .speech(text, x, y)
room.visual.speech('Hello World', 22, 24)
Animates a marker at x
, y
.
// .animatedPosition(x, y)
room.visual.animatedPosition(12, 32)
Draws resource icon of type
at x
, y
, and given size
.
Size defaults to 0.25
.
// .resource(type, x, y)
room.visual.resource("XGHO2", 12, 32)
// .resource(type, x, y, size)
room.visual.resource("K", 12, 32, 0.5)