actionscript 3 - Equivalent to moveReceived in ElectroServer 5 -
i working on proprietary game project , updating legacy code actionscript 1 actionscript 3. in particular, lot of game code previous iteration implemented using electroserver api method movereceived. api provides following description method:
movereceived:
availability
flash player 6.
usage
electroserver.movereceived(type,object,from)
parameters
type either "public" or "private" (object)
object object sent (object)
from name of user sent move (object)
returns
nothing.
description
event fired when move received. can send , receive actual actionscript objects using sendmove , moverecieved. makes creating multiplayer games simpler.
example
the following example of move seen in game characters can jump , shoot.
function movereceived(type:string, ob:object, from:string) { if (type == "private") { var action:string = ob.action; if (action == "shoot") { var x:number = ob.x; var y:number = ob.y; var angle:number = ob.angle; var speed:number = ob.speed; createprojectile(x, y, angle, speed); } else if (action == "jump") { makeopponentjump(); } } } es.movereceived = movereceived;
does know equivalent method actionscript 3 api electroserver 5 be? struggling find performs equivalent role. thank you.
according electroserver 5 manual, "client api @ glance" (link entire manual), need employ these:
publicmessagerequest/publicmessageevent
- used sending messages room , receiving them.privatemessagerequest/privatemessageevent
- used sending messages 1 or more users directly, , receiving them.
you might try rewriting sendmove
function use appropriate public or private message sending function. movereceived
function code should split 2 branches, 1 private, 1 public messages.
Comments
Post a Comment