Objects - Basic Interaction
Entities in the game world exist as object prototypes; if you've never used JavaScript before, you can think of these like instances of a class in Python. Prototypes have both attributes and methods and are accessed in JavaScript like they are in Python.
Syntax:
Referencing a specific spawn through a variable:
spawn = Game.spawns.Spawn1
Moving a Creep:
creep = Game.creeps['upgrader123']
creep.moveTo(creep.room.controller)
Last updated
Was this helpful?