Hi All.
I have made some games using the multiplayer blocks avaliable ( move player 2 with buttons, change player 2 score , … ) , also i’ve tested other ones made buy users
When i upload those games to two consoles joined with jacdac, those games made with blocks don’t work in hardware they are only playable within the simulator
I thought that making a multiplayer game with blocks will act as multiplayer games once detected a jacdac connection but seems that this doesn’t work like i expected.
- Am i right or i am missing somehting ???
Then i’ve fount the forum thread
were there is a real multiplayer game that i can play in my consoles connected via jacdac, but that game is made using JavaScript instead of using blocks, so users learning makecode arcade with blocks can not make their own multiplayer games.
There is an existing jacdac-game extension but there isn’t information about how to use it neither how to use ControllerServices class. An extract of a portion of code from that class is:
...
private askJoin(device: JDDevice): boolean {
game.eventContext(); // initialize the game
control.pushEventContext();
game.showDialog("Arcade Detected", "Join?", "A = OK, B = CANCEL");
let answer: boolean = null;
controller.A.onEvent(ControllerButtonEvent.Pressed, () => answer = true);
controller.B.onEvent(ControllerButtonEvent.Pressed, () => answer = false);
pauseUntil(() =>
// user answered
answer !== null
// server got joined
|| this.hasPlayers()
// other driver dissapeared
|| !jacdac.devices().find(d => d.device_address == device.device_address)
);
// wait until we have an answer or the service
control.popEventContext();
// cache user answer
if (answer !== null)
this.promptedServers.push(device.udidl);
// check that we haven't been join by then
return !!answer
&& !this.hasPlayers()
&& !!jacdac.devices().find(d => d.device_address == device.device_address);
}
...
so i see that there is code made for this purpose
Is this class which make possible to have a real hardware multiplayer game done using blocks without doing any more, or anybody has any sample on how to use jacdac-game extension or this class ?