Hi devs.
I’d like to set you and everyone else a little challenge. It comes from Daniel Shiffman’s “The nature of code” website.
Using VL I would like to see how easily people can mimic the code below (its from processing):
float x = 100;
float y = 100;
float xspeed = 1;
float yspeed = 3.3;
void setup() {
size(640,360);
background(255);
}
void draw() {
background(255);
//Move the ball according to its speed.
x = x + xspeed;
y = y + yspeed;
//Check for bouncing.
if [| (x < 0](https://vvvv.org/documentation/x->-width)) {
xspeed = xspeed * -1;
}
if [| (y < 0](https://vvvv.org/documentation/y->-height)) {
yspeed = yspeed * -1;
}
stroke(0);
fill(175);
//Display the ball at the location (x,y).
ellipse(x,y,16,16);
}
The setup and draw stuff isn’t so important but this is or should be a relatively straight forward task:
//assign x to to something, perhaps an input. Then
x = x + xspeed
//and then set the xspeed
if [x > width) OR (x < 0](https://vvvv.org/documentation/x->-width)-OR-(x-<-0) xspeed = xspeed * -1
The two parts are able to influence eachother, something, the sort of chaining that is difficult to get from vvvv and one of my the hopes for VL. In vvvv there are are a few hoops to jump through for this example but the code is also fairly simple.
Yet in VL I haven’t identified a straight forward way to do this, by which I mean a way that is as intuitive as make my input (from ‘Update’) mutable and adding it to itself.
The actual node graph at the end looks fairly sort of readable but arriving at the solution is currently suprisingly time-consuming.
One could argue, reasonably, that it is a matter of getting used to the language and that the strangeness of some of its features will become a distant memory, but so far I keep tripping over issues such as above: its very much the norm in my experience of VL. I could do with more examples or more documentation, but examples such as the one above should be pretty easy regardless.
Yours,
Saucy guest