Hi, problem is that in two of them, i even don't know how to start. Basically I need somebody to draw me these two sketches. So I cant ask here. I didn't wanted it for free of course.
Ok, I want to create bunch of lines, which will be travelling from bottom to top and being bounced off the borders, ideally speeding up. Then I want to add a mouse interactivity, so when I click the mouse, the lines start travelling.
If you can write a cook-book with steps how should i proceed, I would be very grateful. Thank you.
Without beginning to implement this, I have some pseudocode.
For a single travelling point:
define each line as a pair of vectors (start and end)
p = vector at some starting point (mouse coordinates?)
vel = vector with initial velocity(and direction) of p
distance traveled = 0
last_hit = test for side of line
Loop until distance traveled > some maximum or point hits wall or the top of screen
update p's location by adding vel
distance travelled += vel.mag()
for each line:
hit = test for side of line
hit is different from last_hit, reflect vel against line
if accelerate_on_hit:
multiply vel by some factor
test for hitting top of screen or wall (a wall could be another line)
For a travelling "line", I would probably use an array of points and update them in sequence. Maybe draw a line between each.
Comments
Heck, why not?
Just post them here and ask what you need
Shoot me an email too. My rates are pretty unreasonable!
Oh, you wanted free help? Better post your code here then.
Hi, problem is that in two of them, i even don't know how to start. Basically I need somebody to draw me these two sketches. So I cant ask here. I didn't wanted it for free of course.
Start by describing what it is you want to do. Post the description here so we can point you in the right direction.
Ok, thanks, will do.
Ok, I want to create bunch of lines, which will be travelling from bottom to top and being bounced off the borders, ideally speeding up. Then I want to add a mouse interactivity, so when I click the mouse, the lines start travelling.
If you can write a cook-book with steps how should i proceed, I would be very grateful. Thank you.
Without beginning to implement this, I have some pseudocode.
For a single travelling point:
For a travelling "line", I would probably use an array of points and update them in sequence. Maybe draw a line between each.
Take a look at the
PVectorp5.Vector reference. (Thanks @jeremydouglass)I would have to look up "test side of line" and "reflection against line" myself. It has been a while.
@noahbuddy, p5.js, not processing.js -- p5.js uses p5.Vector, not PVector.
Ok, thank you all!