and you really shouldn't call anything like loadImage() or minim.loadFile() during your draw - file operations are too slow and draw() runs 60 times a seconds.
make them all global variables and load them in setup().
koogs then how do i play a sound when something happens, during a draw??
because the variables are global you can access them anywhere...
import ddf.minim.*;
// global variables
Minim minim;
AudioPlayer song;
boolean play = false;
void setup()
{
size(100, 100);
// start minim and load song
minim = new Minim(this);
song = minim.loadFile("song.wav");
}
void draw()
{
background(0);
// do whatever you want here
// should we play the song?
if (play) {
song.rewind();
song.play();
play = false;
}
}
// play the song when mouse is clicked
void mouseReleased() {
play = true;
}
Answers
post what you have
good luck lmao
I've been programming for about 2 weeks so i don't know anything
edit the post, highlight the code and press ctrl-o to format it.
you will need push/popMatrix for this stuff...
I don't know what the heck all that code is for. Just draw a rotated image:
If you don't understand something, take the time to learn about it!
what does translate (mouseX,mouseY); do?
https://processing.org/reference/translate_.html
translate translates, just like in maths class.
mouseX and mouseY are also described in the reference, but you can probably guess what they do from the name
ctrl-t in the editor will indent your file properly, make it easier to read.
and you really shouldn't call anything like loadImage() or minim.loadFile() during your draw - file operations are too slow and draw() runs 60 times a seconds.
make them all global variables and load them in setup().
give your variables meaningful names so you don't have to waste time trying to remember what l does.
and don't mix variables of different case, that's just asking for trouble.
variables and methods should be lowerIntermedialCase. classes should have InitialCapitals. constants should be ALL_UPPER_CASE.
this is just a waste of time
koogs then how do i play a sound when something happens, during a draw??
sorry i just like to make my code pretty so i instantly know what it does lol don't judge
please reply
because the variables are global you can access them anywhere...
please be patient. i am at work.
thanks!!!111
and for the images i just put image(img,x,y); in the draw and the rest in the setup?
Yes
Try it
Do you like it?
oh yes the lag is gone