I am a new to javascript coding in p5 and i am getting errors when trying to call a function from another javascript file. Here is my html file:
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>p5.js example</title>
<style> body {padding: 0; margin: 0;} </style>
<script src="../p5.min.js"></script>
<script src="../addons/p5.dom.min.js"></script>
<script src="../addons/p5.sound.min.js"></script>
<script src="sketch.js"></script>
<script src="file.js"></script>
</head>
<body>
</body>
</html>
Here is my javascript file 1:
function setup() {
createCanvas(400,400);
}
function draw(){
pr("hello world",x,y);
}
Here is my javascript file 2:
function pr(text,x,y){
text(text,x,y);
}
I edited the function arguments because i forgot that text function has a different sytnax than i wrote. Still getting errors:
InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
Use of the orientation sensor is deprecated. p5.min.js:3:232007
Use of the motion sensor is deprecated. p5.min.js:3:232007
ReferenceError: x is not defined
pr()indraw()with variablexbutdraw()donot have scope of variablex