[SOLVED] Javascript Union Pong/Union Draw

All Union Platform questions, comments, feature requests, and bug reports.

Javascript Union Pong/Union Draw  

Postby aleone00 » Mon 21 Nov 2011 09:34

I have been trying to convert the union draw tutorial to the union pong game but with javascript instead of actionscript. I cant get it to work for some reason. does anyone know how? and could someone maybee make a quick example? Like an example of a moving object in javascript but getting that moving object to move on client2's screen when client1 moves the object. I can get the object to move with arrow keys but I cant figure out how to use the orbiter to send the move message and recieve a move message. And I also don't understand what the command stack is when processing a message? Do i need the command stack?
aleone00
 
Posts: 22
Joined: Tue 15 Nov 2011 09:59

Re: Javascript Union Pong/Union Draw

Postby colin » Thu 24 Nov 2011 15:03

1) a basic avatar-style movement example for javascript is a good idea. we'll put it on our todo list.
2) i don't know what you mean by "the command stack"

colin
colin
 
Posts: 232
Joined: Mon 17 Oct 2011 18:47

Re: Javascript Union Pong/Union Draw

Postby aleone00 » Thu 24 Nov 2011 18:19

1. Thanks. I actually figured it out but a tutorial would still be good just in case other people need help or I need help in the future.
2. In the JavaScript example of union draw, in the final JavaScript code at the end of the tutorial, in the developer comments of proccessing the messages sent from the server it talks about something called the "command stack" I'm not really sure what that is or means? It says that it needs to process the messages in a certain order? I just wanted a further explanation of that section of the code. I will replay with that section of the code in a little while when I go home.
aleone00
 
Posts: 22
Joined: Tue 15 Nov 2011 09:59

Re: Javascript Union Pong/Union Draw

Postby colin » Thu 24 Nov 2011 21:54

in the drawing tutorial, the "command stack" is an ordered list of drawing actions performed by a given user. the concept of "drawing commands" is a custom part of the drawing application, and not related to the core Union infrastructure or OrbiterMicro SDK. the commands are application-specific actions, such as:

Code: Select all
DrawingCommands.SET_THICKNESS
DrawingCommands.MOVE_TO


you do not need to use a similar structure in your applications.

the actual communication occurs by sending messages (with sendUPC()) and setting attributes. for example, here's how a user sends a message to move the drawing pen:

Code: Select all
function broadcastMove (x, y) {
  msgManager.sendUPC(UPC.SEND_MESSAGE_TO_ROOMS,
                     Messages.MOVE,
                     roomID,
                     "false",
                     "",
                     x + "," + y);
}


colin
colin
 
Posts: 232
Joined: Mon 17 Oct 2011 18:47

Re: Javascript Union Pong/Union Draw

Postby aleone00 » Fri 25 Nov 2011 17:09

Thank you I understand now.
aleone00
 
Posts: 22
Joined: Tue 15 Nov 2011 09:59


Return to Union Platform

Online

Users browsing this forum: No registered users and 7 guests