Untitled
unknown
plain_text
5 months ago
638 B
1
Indexable
socket.on("player_move", (data: Tank) => { if (data.name === process.env.TANK_NAME) { myTank = { ...data }; } }); socket.on("new_bullet", (data: Bullet) => { if (data.uid === myTank.uid) { console.log({ new_bullet: data }); } }); await sleep(2000); for (let i = 0; i < 10; i++) { const direction = i % 2 === 0 ? Direction.LEFT : Direction.RIGHT; socket.emit("move", { orient: direction }); await sleep(51); console.log({ shoot: direction, time: new Date().toISOString(), shootable: myTank.shootable, shootCooldown: myTank.shootCooldown, }); socket.emit("shoot", {}); await sleep(800); }
Editor is loading...
Leave a Comment