The lines below are from a sketch with an object that moves to the left and right of the screen and accelerates when the mousepointer is further to the right. It is supposed to stop moving when I press a key but I'm not sure what I should type at keyPressed, I'm supposed to use the boolean canMove. I've tried numerous things but I can't figure it out. Can anyone help me out?
For a school assignment we have to make something in processing using 2 'int' variables. When the assignment is complete we'll connect all laptops and the teachers laptop will send random numbers to ours and that will change the two ints.
The random numbers will be between 0 and 400. However, my project works best with numbers between 0 and 700. I used the map() function to change the range of numbers. But, the map() function doesn't work with ints and I had to change them to floats. So if I understand this software correctly, my teachers pc will try to send ints to mine, but there are no ints anymore because they now are floats. I asked the teacher about it and he said "To be sure, you can change the variables locally to floats" The numbers are sent by a processing sketch called oscp5stuff and it looks like this:
import oscP5.*; import netP5.*;
OscP5 oscP5;
/* incoming osc message are forwarded to the oscEvent method. */ void oscEvent(OscMessage theOscMessage) { if(theOscMessage.checkAddrPattern("/variabele1") == true) { variabele1 = theOscMessage.get(0).intValue(); println(theOscMessage.get(0).intValue()); }