Skip to content

Commit

Permalink
Fix animations
Browse files Browse the repository at this point in the history
  • Loading branch information
mhawryluk committed Dec 24, 2023
1 parent 4097ebb commit b293886
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const playerPaths = {
[14, 8],
[14, 7],
[14, 6],
[14, 6],
[13, 6],
[12, 6],
[11, 6],
Expand Down
7 changes: 4 additions & 3 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,17 @@ class Game {
const timeSensor = document.getElementById(`time-${player}-${i + 1}`);
const positionInterpolator = document.getElementById(`move-${player}-${i + 1}`);

const time = `${new Date().getTime() / 1000}`;

positionInterpolator.setAttribute('keyValue', keyValue);
positionInterpolator.setAttribute('key', key);
timeSensor.setAttribute('cycleInterval', `${movesCount / 2}`);
timeSensor.setAttribute('loop', 'true');
timeSensor.setAttribute('loop', 'false');
timeSensor.setAttribute('starttime', time);

setTimeout(() => {
if (oldTile) this.distributeTokensOnOneTile(oldTile);
this.distributeTokensOnOneTile(newTile);
}, movesCount * 500 + 100);
}, movesCount * 500 + 500);

if (!this.checkForGameOver(player) && this.lastRolledValue !== 6) {
this.nextPlayer();
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ <h1>Ludo 3D</h1>

<PointLight ambientIntensity='0.5' attenuation='1,0,0' color='1,1,1' global='false' intensity='1'
location='7.5 10 7.5' on='true' radius='100'></PointLight>

<!--
<transform translation="7.5 2 7.5">
<inline url='./box.x3d'></inline>
</transform>
</transform> -->

<!-- blue tokens -->
<transform DEF='blue-token-1' id='blue-token-1' translation="3 1 3" visible="false">
Expand Down
2 changes: 1 addition & 1 deletion tileGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for (let player of ['blue', 'green', 'red', 'yellow']) {
code += `
<PositionInterpolator id="move-${player}-${i}" DEF="move-${player}-${i}" key="0 0.5 1" keyValue="1 1 0 0 3 0 0 1 0">
</PositionInterpolator>
<timeSensor id="time-${player}-${i}" DEF="time-${player}-${i}" cycleInterval="2" loop="false"></timeSensor>
<timeSensor id="time-${player}-${i}" DEF="time-${player}-${i}"></timeSensor>
<Route fromNode="time-${player}-${i}" fromField="fraction_changed" toNode="move-${player}-${i}" toField="set_fraction">
</Route>
<Route fromNode="move-${player}-${i}" fromField="value_changed" toNode="${player}-token-${i}" toField="translation">
Expand Down

0 comments on commit b293886

Please sign in to comment.