We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm having a bit of a problem with using methods from the Processing Library. Here is my code... import sprites.utils.*; import sprites.maths.*; import sprites.*; import themidibus.*; import tactu5.*; import supercollider.*; import processing.sound.*;
//First declare objects used for this session
Blocker obstacleBlocktopdown;
Blocker obstacleBlockacross;
Avatar playerAvatar;
Seeker seekerStone1;
GoalState goal;
SoundFile winner;
boolean upPressed = false;
boolean downPressed = false;
boolean leftPressed = false;
boolean rightPressed = false;
boolean winstate = false;
boolean playstate = true;
void setup(){
size(950, 950);
//Initialize object here
obstacleBlocktopdown = new Blocker(width/2, 1, 20, 20, 0, 1.2);
obstacleBlockacross = new Blocker(1, height/2, 20, 20, 2, .4);
playerAvatar = new Avatar(11, 11, 18, 18);
seekerStone1 = new Seeker(1100, 600, 18, 18);
goal = new GoalState(790, 500, 18, 18);
winner = new SoundFile(this, "Marvelous Battle OST's The Intrepid - DASH.mp3");
}
void draw(){
playerAvatar.constrainToScreen();
if (upPressed) {// playerAvatar moves up 1 pixel
playerAvatar.movesup();
}
if (downPressed) {//playerAvatar moves down 1 pixel
playerAvatar.movesdown();
}
if (leftPressed) {//playerAvatar moves to the left 1 pixel
playerAvatar.movesleft();
}
if (rightPressed) {//playerAvatar moves to the right 1 pixel
playerAvatar.movesright();
}
background(0);
obstacleBlocktopdown.run();
obstacleBlockacross.run();
playerAvatar.display();
seekerStone1.synch2avatar();
goal.display();
if (dist(goal.x, goal.y, seekerStone1.x, seekerStone1.y) < 10) {
playstate = false;
winstate = true;
} else if (winstate) {
background (0);
textSize(36);
text("You Win", 100, 100);
text("Seeker has reached Goal!", 100, 400);
textSize(14);
text("Press spacebar to restart", 100, 800);
winner.play();
if (key == ' ') {
winner.stop();
winstate = false;
playstate = true;
seekerStone1.x = 1100;
seekerStone1.y = 600;
playerAvatar.x = 11;
playerAvatar.y = 11;
obstacleBlocktopdown.x = width/2;
obstacleBlocktopdown.y = 0;
obstacleBlockacross.x = 0;
obstacleBlockacross.y = height/2;
}
}
}
//enacts the movement of desired object
void keyPressed (KeyEvent e) {
if (key == CODED) {
if (keyCode == UP) {
upPressed = true;
}
else if (keyCode == DOWN) {
downPressed = true;
}
else if (keyCode == LEFT) {
leftPressed = true;
}
else if (keyCode == RIGHT) {
rightPressed = true;
}
}
}
// stops movement once key(s) are released
void keyReleased(KeyEvent e) {
if (key == CODED) {
if (keyCode == UP) {
upPressed = false;
}
else if (keyCode == DOWN) {
downPressed = false;
}
else if (keyCode == LEFT) {
leftPressed = false;
}
else if (keyCode == RIGHT) {
rightPressed = false;
}
}
}
I've downloaded and imported all the sound libraries from https://processing.org/reference/libraries/sound/index.html but I keep getting the error message "No library found for processing.sound Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder."
This doesn't make sense to me since the libraries folder was automatically put into the 'processing' folder when I downloaded processing. Here is the directory for the library. C:\Users\'computername'\Documents\Processing\libraries ... I tried moving libraries to the folder of the sketch I'm working with > C:\Users\'computername'\Documents\Processing\'sketchfolder'\sketch_140726a> and it still didn't work.
What am I doing wrong here? Where is the 'libraries' folder supposed to be so that my code works properly?
Any help is appreciated.
Answers
Have you read https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library ?
I read that and it doesn't help. I've put the audio into different places and every place mentioned on the site. None of them work. Any other ideas?
You are supposed to use Sketch > Import Libraries... menu in the PDE to install libraries, anyway.
I did. I imported a couple libraries in order to use audio in my code. (I specifically used the "minim" library) When I did that, I got an error saying that the libraries I imported interfered with other libraries imported and some of them should be removed. I don't understand why this happened. I only wanted to use the "Soundfile" class but it won't allow me to because I didn't have the libraries, and when I got all the processing libraries, it said they interfered with the existing ones. Does any one know why this happens?