Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions public/block.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@
img = document.getElementById("PacMan");
pos += 20;
img.style.left = pos + "px";
if (flag === 1) {
img.src = url + '/pac?id=' + flag; // use flag to choose image
flag = 2;
} else {
flag = 1;
}
flag = (pos % 40 === 20) ? 1 : 2; // alternate flag value beetwen 0 and 1
img.src = url + '/pac?id=' + flag; // use flag to choose image
// send position data to Server in url
fetch(url + '/set?x=' + pos);
}
Expand All @@ -26,4 +22,4 @@
<body>
<p>Click on PacMan and the position will be sent to the server".</p>
<img id="PacMan" src='http://localhost:3000/pac?id=2' onclick="Run()" style="position:absolute">
</body>
</body>