the good shepherd
First foray into the word of processing-to-android, my conclusion? Use Lua on Corona SDK instead. A lof of processing libraries are unsupported (actually, only 2 libraries work on the android-processing file) and the emulator is so SO slow. As in drop-dead slow. Also sometimes it jams, or lags, or doesn’t load your file on the emulator.
Simple game I made using boolean conditions. I first tested it using coloured ellipses (red for good guys, blue for evils) then after the conditions worked i.e. when you come within 20px of me, point++; when come within 20px of evils, gameover(); that kind of thing. I really should’ve made classes cos as Joe said – it’s a bit hackey and also not really good form………….
Download code here: http://www.mediafire.com/file/7qsowi1iu3xfo7w/sheepgame.zip
sin wave pulse sensor
Uses the pulse sensor that Yury/Joel made; currently I’m mapping pulse to amplitude of the sin wave (very nifty sin wave using Daniel Shiffman’s equations) although, as usual, I’ve decided to go down the (shiny!!!!) HSB colourmode. Did I mention how much I love HSB???
the processing-recieve code is basically a serial response – it sends strings of ‘b’ (heartbeat) ‘p’ (peak value) ‘t’ (trough value) and ‘d’ (detect) the original one that comes with the sensor is a lot more complicated since it has a ridiculous number of ints(inData) but I cut it down to 4…. and even so, I didn’t use all the variables (compare it to the arduino code, so many ints!). I guess I just wanted to make it easy to edit with, because it’s not really perfect/to my own standards. There’s a bit of jerkyness when the pulse beat drops/rises and debouncing doesn’t really help – it makes it worse since the delay increases the change in amplitude and the coding is kinda hacky – I mapped it as amplitude = float(inData)*1.0f/10. I needed to convert the raw sensor data to frames, but that resulted in something like 81-113 fps/amplitude which made the graphing go crazy, so I divided it by 10 so that it would stay within processing’s 15fps standardisation.
I think improvements would be – gradual the change ‘b’/time(?) since right now ‘b’/beat is a boolean, and the moment it turns true it just snaps the graph (no transition). Map amplitude as ‘p’/peak – ‘t’/trough = drop average, which will give a smoother, more consistent rhythm and if also really *really* think this would be much easier on OF; since I could write it as sin(of_time_elapsed) instead of multiplying frames, dividing it etc etc there’s other things I could change as well, like using xspacing (tighter xspacing for faster heartbeat) and using period. Another thing that might be cool would be to use mimin library and set height as a sound file, so the yvalue will be a ‘note’ on the sound map.
Download code here: http://www.mediafire.com/file/2e9za6wckhb8whz/pulsesensor.zip
Decided to make a simple class example by making TV bars (the kind you get with bad signals):
scrolling tv bars
1. rightclick save as
2. change .jpg to .zip extension
I think if I had more time, I would add a mimin library in it so I could have the audio ‘beep’ sound like a real tv fizzing out
So it started with this which is a random arboretum:
Then I added hsb, and tried to modify to add new node to mouseX, mouseY:
The HSB worked fairly well but it occasionally had render errors and problems with smoothing, but the add new node ran into a lot of difficulty because the library wasn’t really well documented. For instance, the example given had seperate .getnewparticle and .makenewparticle and the documentation was only for .makenewparticle. After reading through the library files, .getnewparticle was an extension (but not a direct extended/inherited class) of .makenewparticle which included xyz where z was -1 at every +10~ nodes so that it would push back and you could see the whole.
After much editing here is a better version:
Improved version adds new node from the closest existing node to mouseX,mouseY and the HSB is now working properly with shininess/ambientlight (the addition of opengl as a 3rd parameter on size + using hint/enable 4x smooth opengl helps clean the lines and render properly) Next, I’m going to try running it on processing to php (thanks joe!) so that it can create multiplayer ‘draw togethers’ so people can create shapes/patterns together. I’ll still try to push the particle/add node and see if I can get them to join properly instead of just making amebas (i.e. add spring/edge between vertices, connecting both)
Latest version of code: DOWNLOAD
1. right-click save
2. change the .jpg extension to .zip
3. unzip, create folder, open in processing
Hello! This is Rachel, 1st year and doing c&c lab. C = one of my favourite letters in the alphabet, it stands for chocolate, cash, comics, cake, (fast) cars, carrefour, cookies, candy, credit, creativity…….. and computation.
psst! secretly, I’m a panda on a go-kart:
- hello world!!! i is here
The library I’m choosing to modify is the traer physics library. I love physics libraries because there’s nothing like giving crushing gravity to internet dreams (who needs flying toasters?? kreuusshhhh’em!)