AnimateObject (int object, int loop, int speed, int repeat)Starts the object number OBJECT animating, using loop number LOOP of its current view. The overall speed of the animation is set with SPEED, where 0 is the fastest, and increasing numbers mean slower. The delay for each frame is worked out as SPEED + FRAME SPD, so the individual frame speeds are relative to this overall speed.
The REPEAT parameter sets whether the animation will continuously repeat the cycling through the frames. If REPEAT is zero, the animation will start from the first frame of LOOP, and go through each frame in turn until the last frame, where it will stop. If REPEAT is 1, when the last frame is reached, it will go back to the first frame and start over again with the animation. If REPEAT is 2, it will do the animation once, but then return the graphic to the first frame and stop (whereas repeat=0 will leave the graphic on the last frame).
Example:
AnimateObject(0,2,0,0);will animate object 0 using loop 2 of its current view once.
See Also: AnimateCharacter, AnimateObjectEx, IsObjectAnimating, SetObjectView
AnimateObjectEx (int object, int loop, int speed, int repeat, int direction, int blocking)As AnimateObject, except that you can specify two extra parameters:
If DIRECTION is 0, it will play forwards as normal. If DIRECTION is 1, the loop will play backwards.
If BLOCKING is 1, then the function will wait for the animation to finish before returning.
See the description of AnimateObject for more information.
Example:
AnimateObjectEx(0,2,0,0,0,1);will animate object 0 using loop 2 of its current view once, forwards, and wait for it to finish before continuing.
See Also: AnimateCharacterEx
AreObjectsColliding (int obj1, int obj2)Checks if object OBJ1 and OBJ2 are touching each other. Returns 1 if they are, and 0 if they are not.
NOTE: This function only performs a rectangular check, even when pixel- perfect click detection is turned on.
Example:
If (AreObjectsColliding(2,3)==1)
{ collision code}
will execute the collision code only if the objects 2 and 3 are colliding.
GetObjectAt (int x, int y)Checks if there is a room object at SCREEN co-ordinates (X,Y). Returns the object number if there is, or -1 if there is not.
See the description of GetLocationName for more on screen co-ordinates.
Example:
If (GetObjectAt(211,145)==4}
{code here}
will execute the code only if object 4 is on the screen coordinates 211,145.See Also: GetHotspotAt, GetLocationName
GetObjectGraphic (int object)Returns the current slot number that OBJECT is displayed as.
Example:
If (GetObjectGraphic(3)==155)
{ code here}
will wxecute the code if object 3 is displayed as the image stored in sprite manager’s slot 155.See Also: SetObjectGraphic
GetObjectX (int object)Returns the X co-ordinate of room object number OBJECT.
Example:
int=GetObjectX(1);will pass the X coordinate of object 1 to the integer int.
See Also: GetObjectY, IsObjectAnimating, IsObjectOn, SetObjectPosition
GetObjectY (int object)Returns the Y co-ordinate of room object number OBJECT.
Example:
int=GetObjectY(1);will pass the Y coordinate of object 1 to the integer int.
See Also: GetObjectX, IsObjectAnimating, SetObjectPosition
IsObjectAnimating (int object)Returns 1 if the specified OBJECT is currently animating. Returns 0 if the object has finished its animation.
Example:
AnimateObject(2,5,0,0); while (IsObjectAnimating(2)==1) Wait(1);will animate object 2 and wait until the animation finishes.
See Also: IsObjectMoving, GetObjectX, GetObjectY
IsObjectMoving (int object)Returns 1 if the object is currently moving, or 0 if not.
Example:
MoveObject(2,125,40,0); if (IsObjectMoving(2)==1) Wait(1);will move object 2 to 125,40 and return control to the player when the object gets there.
See Also: IsObjectAnimating
IsObjectOn (int object)Returns 1 if the object is currently turned on, or 0 if not.
Example:
if (IsObjectOn (2) == 0) {
ObjectOn (2);
Display("The evil object has appeared!!!");
}
will turn on object 2 if it is currently off.See Also: GetObjectX, IsObjectAnimating, ObjectOff, ObjectOn
MergeObject (int object)Merges object number OBJECT into the background scene for this room. By doing this, the object becomes part of the background and so does not slow the game down. This is a 1-way operation - once the object has been merged, it cannot be changed back and the state of the room is permanently altered. Therefore you should only use this function if a game event has occured that means the room is permanently changed.
NOTE: after calling this function, you cannot use the object any more and it is permanently removed from the game.
NOTE: objects can only be merged if the object graphic was imported at the same colour depth as the background graphic.
Example:
MergeObject(3);will merge the object’s image into the room’s background image and make the image unusable.
MoveObject (int object, int x, int y, int speed)Starts the object OBJECT moving from its current location to (X,Y). It will move at speed SPEED, which uses the same scale as the character Walk Speed values in the Room Editor.
Example:
MoveObject(2,125,40,0); if (IsObjectMoving(2)==1) Wait(1);will move object 2 to 125,40 and return control to the player when the object gets there.
See Also: MoveCharacter, MoveObjectDirect
MoveObjectDirect (int object, int x, int y, int speed)Starts OBJECT moving from its current location to (X,Y), ignoring all walkable areas on the screen. The object will therefore move directly to the destination in a straight line.
Example:
MoveObjectDirect(4,245,34,0);will move object 4 to 245,34 ignoring walkable areas.
See Also: MoveObject
ObjectOff (int object)Turns object number OBJECT off. It will no longer be displayed in this room until you use an ObjectOn command.
Example:
ObjectOff(5);will make object number 5 of the current room disappear.
ObjectOn (int object)Turns object number OBJECT on. It may have been turned off previously with ObjectOff or may have been set initially off in the editor.
Example:
ObjectOn(5);will make object 5 of the current room appear.
See Also: IsObjectOn, ObjectOff
RunObjectInteraction (int object, int mode)Processes the interaction list as if the player had clicked the mouse on object number OBJECT in the current room, using cursor mode MODE. MODE is one of the MODE_* constants listed in the ProcessClick description.
Example:
RunObjectInteraction(3,MODE_USE);will execute the code defined in the object’s number 3 "USE OBJECT" interaction.
See Also: ProcessClick, RunCharacterInteraction, RunHotspotInteraction
SetObjectBaseline (int object, int baseline)Changes OBJECT's baseline to BASELINE. This modifies the line you can set in the editor. You can disable the baseline (and revert to using the base of the object's image on the screen) by passing 0 as the baseline. Otherwise, the baseline is the Y screen co-ordinate you want to use, normally from 1 to 200 unless you have a taller than usual room.
Example:
SetObjectBaseline(4,100);will change object’s 4 baseline to a line positioned at y coordinate 100.
See Also: SetCharacterBaseline, SetWalkBehindBase
SetObjectClickable (int object, int is_clickable)Sets whether the OBJECT is recognised as something which the player can interact with. If you pass IS_CLICKABLE as 1, then the player can look at, speak to, and so on the object. If you pass IS_CLICKABLE as 0, then the object will not respond to clicks and the mouse will activate whatever is behind the object. This is useful if you are using the object for visual effects and don't want it to be clicked on by the player.
Example:
SetObjectClickable(2,0);will make object 2 ignore clicks from the player.
See Also: SetCharacterClickable, SetObjectIgnoreWalkbehinds
SetObjectFrame (int object, int view, int loop, int frame)Sets object number OBJECT's graphic to frame FRAME of loop LOOP of view number VIEW. This is useful if you want the object to use the second loop in a view for an animation, because using the SetObjectView function in room startup code will cause loop 0 to breifly flash on the screen first.
Example:
SetObjectFrame(1,12,2,0);will change the object’s 1 image to frame 0 of loop 2 of view 12.
See Also: SetObjectView
SetObjectGraphic (int object, int slot)Sets the graphic for object number OBJECT to slot number SLOT. You can get the slot number from the Sprite Manager. If the object is currently animating (from an AnimateObject command) then the animation will be stopped.
Example:
SetObjectGraphic(2,100);will change the object’s 2 image to the image stored in the sprite manager’s slot 100.
See Also: SetObjectFrame, SetObjectView
SetObjectIgnoreWalkbehinds (int object, int ignore)Sets whether object OBJECT is affected by walkbehind areas. Passing 0 (the default setting) means that the object will be placed behind walk-behind areas according to the relevant baselines. Passing 1 means that the object will never be placed behind a walk-behind area. This is useful if for example you want an object to be a picture on a wall, and the wall can be walked behind - but you also want it to act correctly in relation to characters, so changing its baseline wouldn't work.
Example:
SetObjectIgnoreWalkBehinds (1,1);will make object 1 ignore walk behinds.
See Also: SetCharacterIgnoreWalkbehinds, SetObjectClickable
SetObjectPosition (int object, int x, int y)Changes the object number OBJECT's position to (X,Y). These co-ordinates specify the lower-left hand corner of the object.
Example:
SetObjectPosition(2,100,100);will change object’s 2 position to 100,100.
See Also: GetObjectX, GetObjectY
SetObjectTransparency (int object, int amount)Sets OBJECT to be AMOUNT Setting AMOUNT to 100 means it is totally invisible, and lower values represent varying levels of transparency. Pass AMOUNT as 0 to stop the object being transparent. NOTE: Transparency currently only works in hi-color games, and the object must have been imported in hi-colour for the transparency to work. NOTE: Having a large transparent object can significantly slow down the engine.
Example:
SetObjectTransparency(0,90);will make object 0 almost invisible.
See Also: SetCharacterTransparency
SetObjectView (int object, int view)Sets object number OBJECT's view to VIEW. The graphic is set to the first frame of loop 0 of the view.
Example:
SetObjectView(3,14);will change object’s 3 view to view number 14.
See Also: AnimateObject, SetObjectFrame