I have a screen where I would like to calculate the next x and y based on angle. The first footstep is this example starts at Step 1. How can I calculate the next footstep where I want to increase going forward by 120 and the side step needs to weave in and out of about 60.
Please bear in mind that the starting point could be x = 100, y = 100 with the angle being 180 so the footsteps would have to then be going up the y axis.
I've attempted the following Javascript but the footsteps seem to get confused:
this.startingFootPrintX = Math.floor(Math.random() * 1000) + 20; //Random number between 20 and 1000
this.startingFootPrintY = Math.floor(Math.random() * 560) + 20; //Random number between 20 and 560
this.startingAngle = Math.floor(Math.random() * 340) + 20; //Random number between 20 and 340
startFootSteps();
startFootSteps(){
console.log(this.startingFootPrintX);
console.log(this.startingFootPrintY);
this.startingFootPrintX = Math.round(Math.cos(this.startingAngle * Math.PI / 180) * 120 + this.startingFootPrintX);
this.startingFootPrintY = Math.round(Math.sin(this.startingAngle * Math.PI / 180) * 60 + this.startingFootPrintY);
setInterval(function () {
startFootSteps();
}, 3000);
}
I have buttons that I make with an each sentence in jade each u in requests form.form-horizontal(method="post") input(type='button', value='Accept #{u.friend}', onclick='doAction(this....
I have buttons that I make with an each sentence in jade each u in requests form.form-horizontal(method="post") input(type='button', value='Accept #{u.friend}', onclick='doAction(this....
It's a simple question. If I click the box , I want to move 200px to the left. but it's hard to me Please help me! where's the problem? <style> .box { width: 200px; height: 200px; ...
It's a simple question. If I click the box , I want to move 200px to the left. but it's hard to me Please help me! where's the problem? <style> .box { width: 200px; height: 200px; ...
I have a function that is triggered when .btn is clicked, it will check if the input and text area with the class .req are filled or not. If not, its suppose to select only the empty elements and add ...
I have a function that is triggered when .btn is clicked, it will check if the input and text area with the class .req are filled or not. If not, its suppose to select only the empty elements and add ...
The code below is a simple Node.js web server that responds to a request when the URL is matched. Researching online about node.js it is stated that once you start your script (node index.js) ...
The code below is a simple Node.js web server that responds to a request when the URL is matched. Researching online about node.js it is stated that once you start your script (node index.js) ...