Now that i've tried that, it's saying field component.x is not visible, however the .y .hei and .wid are all loading fine, not seeing my issue! This task is driving me insane :P
EDIT:
that didn't work for me either, i put the bounce commands inside the for statement that generates the blocks. And it just goes right through where the blocks are.
EDIT2: Ignore that, it's down to a flaw in my code. so I'm using queries in the if statements to decide which line it is hitting. there's if it's greater than the side it's hitting, and lower than the side it's hitting + the ballspeed, this allows a threshold for it to still bounce back if the speed doesn't allow it to DIRECTLY hit the side of the block. however these aren't coming true in my code, heres the full code of the collision checking
- for (int i = 0; i< data.size();i++) {
- item = (brick) data.get(i);
- if(bally>=item.y && bally<=item.hei && ballx>=item.x && ballx<=item.wid){
-
- if(ballx>item.x&&ballx<item.x+speedx){
- println(22);
- xmove=xmove*-1;
- }
- if(ballx<item.wid&&ballx>item.wid-speedx){
- println(11);
- xmove=xmove*-1;
- }
- if(bally>item.y&&bally<item.y+speedy){
- ymove=ymove*-1;
- println(33);
- }
- if(bally<item.hei&&bally>item.hei-speedy){
- ymove=ymove*-1;
- println(44);
- }
-
- }