EditPersistentObject(persistentObjectId , new_persistentObjectStruct)

Description

This function edits a persistent object after you provide its ID.

Syntax

EditPersistentObject(persistentObjectId ,  new_persistentObjectStruct)

Returns

N/A

Example Implementation

//Get the ball first (assuming you dont know its POid)
var ballPOid = -1;
with(oPersistentObject){
    if(persistentObjectProperties.type == "ball"){
        ballPOid = persistentObjectId
    }
}
var ball_updated = {
    type: "ball",
    _x : 400,
    _y : 400
}
EditPersistentObject(ballPOid,ball_updated)

This requests the server to edit the ball's properties, and is likewise updated on everyone else's screen.

Last updated