|
|
|
@ -73,13 +73,21 @@ export default (props) => {
|
|
|
|
|
let currentPos = { ...initialPos }; |
|
|
|
|
|
|
|
|
|
// Draw initial position
|
|
|
|
|
p5.ellipse(currentPos.x * stepX, currentPos.y * stepY, 10, 10); |
|
|
|
|
p5.ellipse(currentPos.x * stepX, currentPos.y * stepY, 5, 5); |
|
|
|
|
|
|
|
|
|
for (let pos of playerPath) { |
|
|
|
|
|
|
|
|
|
const previous = { ...currentPos }; |
|
|
|
|
|
|
|
|
|
currentPos.x += pos.x; |
|
|
|
|
currentPos.y += pos.y; |
|
|
|
|
|
|
|
|
|
p5.ellipse(currentPos.x * stepX, currentPos.y * stepY, 10, 10); |
|
|
|
|
p5.push(); |
|
|
|
|
p5.stroke(150); |
|
|
|
|
p5.line(previous.x * stepX, previous.y * stepY, currentPos.x * stepX, currentPos.y * stepY); |
|
|
|
|
p5.pop(); |
|
|
|
|
|
|
|
|
|
p5.ellipse(currentPos.x * stepX, currentPos.y * stepY, 5, 5); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
p5.pop(); |
|
|
|
|