Skip to content

Commit 5a7902d

Browse files
README: Tab Fix
1 parent 4a4d2e2 commit 5a7902d

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

readme.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -101,43 +101,43 @@ If you don't want to use RPC, override the "message" event on server/client.
101101
1. Disabling RPC on GameServer:
102102
```gml
103103
function GameServer(_port) : TCPServer(_port) constructor {
104-
// Disable RPC by setting the message event
105-
setEvent("message", function(_message) {
106-
var _data = _message.data;
107-
var _socket = _message.socket;
108-
// If the message type is "create_ball"
109-
if (_data.type == "create_ball") {
110-
// Store the data
111-
data = _data;
112-
// Send this data to all clients
113-
clients.forEach(function(_client_socket) {
114-
network.sendData(data, _client_socket);
115-
});
116-
}
117-
});
104+
// Disable RPC by setting the message event
105+
setEvent("message", function(_message) {
106+
var _data = _message.data;
107+
var _socket = _message.socket;
108+
// If the message type is "create_ball"
109+
if (_data.type == "create_ball") {
110+
// Store the data
111+
data = _data;
112+
// Send this data to all clients
113+
clients.forEach(function(_client_socket) {
114+
network.sendData(data, _client_socket);
115+
});
116+
}
117+
});
118118
}
119119
```
120120
2. Disable RPC on GameClient:
121121
```gml
122122
function GameClient(_ip, _port) : TCPSocket(_ip, _port) constructor {
123-
// Disable RPC by setting the message event
124-
setEvent("message", function(_message) {
125-
var _data = _message.data;
126-
// If the message type is "create_ball"
127-
if (_data.type == "create_ball") {
128-
// Create the ball instance
129-
instance_create_depth(_data.x, _data.y, 0, obj_ball);
130-
}
131-
});
132-
static step = function() {
133-
if (mouse_check_button_pressed(mb_left)) {
134-
// Send message to create ball
135-
network.sendData({
136-
type: "create_ball",
137-
x: mouse_x,
138-
y: mouse_y
139-
});
140-
}
141-
}
123+
// Disable RPC by setting the message event
124+
setEvent("message", function(_message) {
125+
var _data = _message.data;
126+
// If the message type is "create_ball"
127+
if (_data.type == "create_ball") {
128+
// Create the ball instance
129+
instance_create_depth(_data.x, _data.y, 0, obj_ball);
130+
}
131+
});
132+
static step = function() {
133+
if (mouse_check_button_pressed(mb_left)) {
134+
// Send message to create ball
135+
network.sendData({
136+
type: "create_ball",
137+
x: mouse_x,
138+
y: mouse_y
139+
});
140+
}
141+
}
142142
}
143143
```

0 commit comments

Comments
 (0)