Bump...
Hi!
I'm trying to make a program that would let you draw and send it to other people over internet. I decided to use Socket.io. So, I learned how to use Socket.io and I coded the server.js file.
var io = require("socket.io").listen(8080); var map = "no"; var angle = 0; var posx = 0; var posy = 0; var color = ""; // All functions that can be called from client // This happens when user connects io.sockets.on("connection", function (socket) { // Telling to the client that connection is established socket.emit('message', "welcome"); // Clears the canvas for everybody socket.on("clear", function () { angle = 0; posx = 0; posy = 0; color = ""; }); // Refresh canvas when somebody draws socket.on("update", function () { socket.broadcast.emit(angle, posx, posy, color); console.log("Sent!"); }); // Handles map choosing socket.on("chosen", function (data) { map = data; }); // Sends map name to client if map is chosen socket.on("map", function () { if (map == "no"){ socket.emit('message', "no"); } else{ socket.emit('message', map); } }); // Gets pen's angle from client socket.on("angle", function (data) { angle = data; console.log("Angle from client!"); }); // Gets pen's position on x socket.on("posx", function (data) { posx = data; console.log("PosX from client!"); }); // Gets pen's position on y socket.on("posy", function (data) { posy = data; console.log("PosY from client!"); }); // Gets pen's color socket.on("color", function (data) { color = data; console.log("Color from client!"); }); });
Everything was fine, until the client side event making. The server gets the data and sends it, but I don't really know how to process that data client side. It should cut every piece of data at "," and color at ";". Tried tokenat and sockets slicing, but nope, not working.
And also, Socket eventing seems to destroy this drawing method. I've been struggling with this problem for days and I'm desperate. Any help is highly appreciated!
Just one question, how can I change the color of the line. I can change the color of all the lines at the same time but i can't change them individually.
LittleStain Your capx is perfect! I just needed that there's not unwanted gaps in the line. But those little gaps are actually better than a straight line, it gives nice unique touch to it <img src="smileys/smiley4.gif" border="0" align="middle" />
Develop games in your browser. Powerful, performant & highly capable.
I've been trying to solve this problem for days but nothing seems to work. So when user draws to the screen too fast the line breaks from multiple points.
I have no idea how I should continue working on this. All ideas are appreciated.
I'm trying to make real time canvas streaming like in Skype. It should record the canvas and record voice. One guy should be able to draw to the canvas and other people to see it over internet. They should be able to talk at the same time in the program.
So, I've been trying to make somekinda recording system that would record actions made on canvas in real time and save it to file. Something like in Draw Something. I haven't made any progress on that. I need help in this problem and I'm willing to download any plugin needed for it to work.
That's a nice little plugin. Will come in handy on my development. Thanks!
How about setting them solid?
You definitely deserve a holiday. Have fun! <img src="smileys/smiley1.gif" border="0" align="middle" />
But remember not to minify the script.
I'm working on sample capx. If you want to export the game to mobile, you're gonna need C2 Personal Edition(or Business).
Member since 28 May, 2013