Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Noobhub - Free Opensource Multiplayer And Network Messaging For Gideros & Coronasdk - Page 3 — Gideros Forum

Noobhub - Free Opensource Multiplayer And Network Messaging For Gideros & Coronasdk

13»

Comments

  • jdbcjdbc Member
    edited February 2016
    @jdbc i want to ask about your sample project using this library. Is the ball's movement also synced between devices like the paddle? Or its not, the ball going on their own but still on the same route on each device?
    You only need to communicate paddle movement to update paddle position. Within GameScene:onEnterFrame function:
    if (target) then
    		local paddle = self.paddle
    		if (paddle:getX() - paddle:getWidth() * 0.5 < target.x) then
    			paddle:move(5)
    			self:publish_private(5)
    		elseif (paddle:getX() - paddle:getWidth() * 0.5 > target.x) then
    			paddle:move(-5)
    			self:publish_private(-5)
    		end
    	end
    For instance if paddle red is moving in device 1, publish a message in the private channel to update paddle red in device 2 and box2d does the rest in both devices.
Sign In or Register to comment.