-u is no longer available as a global, only within the running actor code; enable passing args to use
Some checks failed
Build and Deploy / build-macos (push) Failing after 4s
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
Build and Deploy / build-linux (push) Has been cancelled

This commit is contained in:
2025-05-22 18:58:13 -05:00
parent 698dbd81ae
commit efd98460c5
19 changed files with 161 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
/* main.js runs the demo with your prototype-based grid */
var moth = use('moth')
var moth = use('moth', $_.delay)
var json = use('json')
var res = 160
@@ -88,7 +88,7 @@ prosperon.on('mouse_button_down', function(e) {
holdingPiece = true;
// Send pickup notification to opponent
if (opponent) {
$_.send(opponent, {
send(opponent, {
type: 'piece_pickup',
pos: c
});
@@ -120,7 +120,7 @@ prosperon.on('mouse_button_up', function(e) {
console.log("Made move from", selectPos, "to", c);
// Send move to opponent
console.log("Sending move to opponent:", opponent);
$_.send(opponent, {
send(opponent, {
type: 'move',
from: selectPos,
to: c
@@ -135,7 +135,7 @@ prosperon.on('mouse_button_up', function(e) {
// Send piece drop notification to opponent
if (opponent) {
$_.send(opponent, {
send(opponent, {
type: 'piece_drop'
});
}
@@ -155,7 +155,7 @@ prosperon.on('mouse_motion', function(e) {
// Send mouse position to opponent in real-time
if (opponent && gameState === 'connected') {
$_.send(opponent, {
send(opponent, {
type: 'mouse_move',
pos: c,
holding: holdingPiece,
@@ -292,7 +292,7 @@ function startServer() {
console.log("Portal received contact message");
// Reply with this actor to establish connection
console.log (json.encode($_))
$_.send(e, $_);
send(e, $_);
console.log("Portal replied with server actor");
}, 5678);
}
@@ -308,7 +308,7 @@ function joinServer() {
console.log("Connection established with server, sending join request");
// Send a greet message with our actor object
$_.send(opponent, {
send(opponent, {
type: 'greet',
client_actor: $_
});
@@ -335,7 +335,7 @@ var ioguy = {
}
};
$_.send(ioguy, {
send(ioguy, {
type: "subscribe",
actor: $_
});
@@ -355,7 +355,7 @@ $_.receiver(e => {
// Send game_start to the client
console.log("Sending game_start to client");
$_.send(opponent, {
send(opponent, {
type: 'game_start',
your_color: 'black'
});