You declare a global boolean variable indicating if you video is playing or not. When the value goes beyond the threshold, you set the boolean value to true and call the movie's play() function.
Having the boolean value checked in the conditional is important so in case your sensor goes above 30 a second time, it does not call play movie again.
Sorry, that means any previous code. I just wanted to emphasize the usage of a global variable. The changes I suggest needs to be implemented in line 36 of your code. Please also follow @Chrisir's direction.
Answers
Please edit your post and format your code. Select your code and press ctrl+o and have an empty line above and below your code.
Kf
im stuck on line 36 like i dont know what to do after this what command should i use??
In line 37 you want line 17 and also set a boolean playMovie to true here which you then use in line 41 above
You declare a global boolean variable indicating if you video is playing or not. When the value goes beyond the threshold, you set the boolean value to true and call the movie's play() function.
Having the boolean value checked in the conditional is important so in case your sensor goes above 30 a second time, it does not call play movie again.
Kf
(...) (...) (...)
what should i put in them?
@james
Sorry, that means any previous code. I just wanted to emphasize the usage of a global variable. The changes I suggest needs to be implemented in line 36 of your code. Please also follow @Chrisir's direction.
Kf
but is that needed ? and chris direction line 37 and 17 in empty
im going to try it now and lets see what happens
jjjjjjjjjjjjjjjj
you did it wrong.
chrisir so what can i do? please this really urgent and this is my first time coding i am so sorry for the troubles.
you need to rethink your usage of isPlaying
chriss omg your a legend mate, thank you soooooooooooooo much
also please use ctrl-t in processing to auto-format your code
Global access means it is declared before setup():
boolean isPlaying=false;
must be before setup()Further remarks
You also kept this
myMovie.play();
in setup which started the movie immediately. Bad.You also had this
image(myMovie, 0, 0);
without the if-clauseif (isPlaying) { // !!!
. Bad.remove all
!!!!
nowby the way
This
isPlaying==false
is the same as!isPlaying
This
if (isPlaying==true) {
is the same asif (isPlaying) {
h
no. Sorry, it's meant to stay for others to learn
m.
p