Référence › Elements — 32 commandes
clearallobjects
Entrée: none
Sortie: none
Clears all objects in all spacers.
clearallobjects
clearobjects
Entrée: class (word)
Sortie: none
Clears all objects of the given class.
clearobjects "class
deleteobject
Entrée: name (word) | class (word)
Sortie: none
deleteobject (erases) the specified object. See newobject, object
deleteobject "name "class
dropobject
Entrée: name (word) OR [name class] (list) | model (word) OR [model1 msdelay…] (list) OR [[ico 5]] (list of lists)
Sortie: none
A shorthand to create an object at the current turtle's position with the current turtle's vectors. If unspecified the object's class is the name of the calling turtle, and the data portion of the object is left blank. See newobject.
dropobject "object "model
hideallobjects
Entrée: none
Sortie: none
Hides all objects. See newobject, object, showallobjects
hideallobjects
hideobject
Entrée: name (word) | class (word)
Sortie: none
Hide the specified object. See newobject, object, hideobjects
hideobject "object "class
hideobjects
Entrée: class (word)
Sortie: none
Hide objects of the specified class. See newobject, object, hideobject
hideobjects "class
listobjectclasses
Entrée: none
Sortie: none
Prints the currently defined object classes to the screen. See listobjects, newobject
listobjectclasses
listobjects
Entrée: class (word)
Sortie: none
Prints the currently defined objects belonging to the specified class to the screen. See listobjectclasses
listobjects
missile
Entrée: id (word)
Sortie: list
Returns a list containing the missile's position, direction, speed and remaining time / distance. See newmissile
show missile "missileid
missiles
Entrée: class (word)
Sortie: list
Returns a list of currently active missiles belonging to the specified missile class. See newmissile
show missiles "trident
missilescale
Entrée: none
Sortie: number
Returns the current missile scale (size). See setmissilescale, newmissile
show missilescale
nearmissiles
Entrée: distance or [distance class] or [distance class [position]]
Sortie: list
Returns a list of lists containing the id and class of any missiles within the given distance of the calling turtle, or a list of missile ids if the distance and class are provided as a list. If a third list position parameter is provided nearmissiles returns the missiles near that position.
show nearmissiles 20
show nearmissiles [20 missiles]
show nearmissiles [20 missiles [100 100 0]]
nearobjects
Entrée: class (word) | distance (number) OR [distance position] (list)
Sortie: names (list)
Returns a list of objects of the given class within the specified distance of the calling turtle, unless an optional position is specified. Note that hidden objects are not listed by nearobjects. See nearobjectp, newobjects, objects
show nearobjects "balloons 20
newmissile
Entrée: class (word) OR [class physics…] | model (word) OR [model1 msdelay model2 msdelay model3…] OR [[ico 5]] | heading OR [vector] | speed (number) OR [speed [location]] | expiry (milliseconds) or [expiry] (turtle-units)
Sortie: none
Creates a new 'missile' with the specified parameters, 'fired' from the position of the calling turtle. The first parameter defines the class, or group of missiles, the second defines the turtle model or models used by the missile, the heading (relative to the turtle's direction) or absolute vector is the direction the missile is 'fired' in, the speed is the number of turtle-units the missile travels in one second (this parameter can also be provided as a list with the first value being the speed and the second value being the location), and the final parameter defines if the missile expires after a certain number of milliseconds (number) or after it travels a certain distance [number as single list item] – 0 for this value causes it to travel forever.
A missile may use the physics engine if instead of a class word, the class is given in a list, with the additional physics parameters: physical, mechanical, elastic (except to other missiles) elasticmissile (also with missiles); window (default), wrap or bounce; nogravity (default) or gravity; noreorient (default) or reorient; notorque (default) or torque – only the first parameter is required, but to activate other parameters all intervening parameters are required.
Note that missiles inherit physical parameters from the calling turtle (mass, elasticity and friction) and so these must be set appropriately before calling newmissile. A trick would be to use a hatchling to set the parameters and launch the missile. Also, if two physical missiles of different classes collide, they both expire.
See newmissileid, on, nearmissilep, missile, missilep and stopmissile.
newmissile "missile "turtle forwarddir 20 2000
newmissileid
Entrée: class (word) | model (word) OR [model1 msdelay model2 msdelay model3…] | [vector] | speed (number) OR [speed [location]] | expiry (milliseconds) or [expiry] (turtle-units)
Sortie: id (word)
Creates a new 'missile' with the specified parameters and returns the name of the missile. See newmissile for complete syntax
show newmissileid "missile "turtle forwarddir 20 2000
newobject
Entrée: name (word) | class (word) | position (list) | heading OR vectors (list) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list)
Sortie: none
Creates a new object. Objects are static elements such as powerups that can be detected by using nearobjectp and nearobjects.
Note that objects inherit physical parameters from the calling turtle (mass, elasticity and friction) and so these must be set appropriately before calling newobject.
An object may use the physics engine if instead of a class word, the class is given in a list, with the additional physics parameters: physical, mechanical or elastic; window (default), wrap or bounce; nogravity (default) or gravity; noreorient (default) or reorient; notorque (default) or torque – only the first parameter is required, but to activate other parameters all intervening parameters are required.
See newobjects, which can create many objects at once, also object, hideobject, showobject, deleteobject, dropobject, updateobject
newobject "name "class position vectors "model [optional data may be left empty]
newobjects
Entrée: nameprefix (word) | class (word) | [positions] (list of lists) | vectors (list) OR [vectors] (list of lists) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list) OR [[data1][data2]] (list of lists)
Sortie: none
Creates multiple new objects of the same class. There must be a unique position specified for all new objects (as a list of lists). The number of provided positions dictates the number of objects created. They may share a common list of vectors, or each have unique vectors. They generally all share the same model, although a dynamically generated model (by providing model code) may be used to vary model presentation. A common data element may be provided (which can be empty) or unique data may be provided for each new object. See newobject for more information on objects.
newobjects "nameprefix "class [positions] vectors "model [optional data may be left empty]
object
Entrée: name (word) | class (word)
Sortie: [position vectors model data] (list)
Returns the object's status. See newobject, objects, objectclasses, listobjects, listobjectclasses
show object "name "class
objectclasses
Entrée: none
Sortie: list
Returns a list of all the object classes with currently defined objects. See clearobjects, listobjectclasses
show objectclasses
objects
Entrée: class (word)
Sortie: names (list)
Returns the names of all the objects belonging to the specified class. See object, newobject
show objects "class
removeobject
Entrée: name (word) | class (word)
Sortie: none
Removes (erases) the specified object. See newobject, object
removeobject "name "class
setmissilescale
Entrée: number
Sortie: none
Sets the scale (size) of subsequently instantiated missile models. See newmissile, missilescale
setmissilescale 2
showallobjects
Entrée: none
Sortie: none
Shows all objects. See hideallobjects
showallobjects
showobject
Entrée: name (word) | class (word)
Sortie: none
Shows the object of the given name and class. See hideobject
showobject "name "class
showobjects
Entrée: class (word)
Sortie: none
Shows the objects of the given class. See hideobjects
showobjects "class
stillobject
Entrée: "name | "class OR [name1 name2…] | "class OR "name | [class1 class2…]
Sortie: none
Zeroes velocity and angular velocity of the specified object. If name is a list, stills all listed objects of the given class. If class is a list, ignores name and stills all objects in the listed classes. See newobject, object, hideobject, showobject, deleteobject
stillobject "myobject "enemies
stillobject [obj1 obj2 obj3] "powerups
stillobject "ignored [enemies powerups]
stopmissile
Entrée: id (word) or [id model1 msdelay model2 msdelay…]
Sortie: none
Stops the missile of the given id, displaying the optional animation before de-existing. The animation is created using the thread that calls stopmissile, so to prevent it from blocking, it needs to be executed by a newworker eg newworker [stopmissile [id anim1 100 anim2 100]]
stopmissile "id
stopmissile [id anim1 100 anim2 100 anim3 100]
stopmissiles
Entrée: class (word) or [class OR [id1 id2 id3…] model1 msdelay model2 msdelay…]
Sortie: none
Stops the missiles of the given class or list of missile ids, displaying the optional animation before de-existing them.
stopmissiles "class
stopmissiles [class anim1 100 anim2 100 anim3 100]
stopmissiles [[id1 id2 id3]]
stopmissiles [[id1 id2 id3] anim1 100 anim2 100]
stopnearmissiles
Entrée: distance OR [distance class] OR [distance class position] OR [distance [class model1 msdelay…] (position)]
Sortie: none
Stops missiles near the calling turtle or near the given position (if specified) within the given distance. See newmissle, stopmissiles
stopnearmissiles 10
stopnearmissiles [10 missile]
updateobject
Entrée: name (word) | class (word) | position (list) | vectors (list) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list)
Sortie: none
Updates an existing object. See newobject
updateobject "name "class position vectors "model [optional data may be left empty]
updateobjects
Entrée: nameprefix (word) | class (word) | [positions] (list of lists) | vectors (list) OR [vectors] (list of lists) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list) OR [[data1][data2]] (list of lists)
Sortie: none
Updates multiple objects of the same class. See newobjects
updateobjects "nameprefix "class [positions] vectors "model [optional data may be left empty]